Change to a different logic

This commit is contained in:
Thomas Göttgens
2022-06-16 20:54:50 +02:00
committed by GitHub
parent 9d8f9613d4
commit 3d3511ceeb

View File

@@ -101,15 +101,14 @@ const char *getDeviceName()
getMacAddr(dmac); getMacAddr(dmac);
// Meshtastic_ab3c // Meshtastic_ab3c or Shortname_abcd
static char name[30]; static char name[20];
// If we have an owner shortname and it is short. sprintf(name, "%02x%02x", dmac[4], dmac[5]);
if (owner.short_name != NULL // if the shortname exists and is NOT the new default of ab3c, use it for BLE name.
&& strlen(owner.short_name) >= 2 if ((owner.short_name != NULL) && (owner.short_name != name)) {
&& strlen(owner.short_name) < 10) { sprintf(name, "%s_%02x%02x", owner.short_name, dmac[4], dmac[5]);
sprintf(name, "Meshtastic_%s", owner.short_name);
} else { } else {
sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]); sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]);
} }
return name; return name;
} }