When configured set meshtastic bluetooth name based on owner shortname.

This commit is contained in:
Holden Karau 2022-04-30 14:48:31 -07:00
parent 8e996e3e63
commit e1f28982cf

View File

@ -97,8 +97,15 @@ const char *getDeviceName()
getMacAddr(dmac); getMacAddr(dmac);
// Meshtastic_ab3c // Meshtastic_ab3c
static char name[20]; static char name[30];
sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]); // If we have an owner shortname and it is short.
if (owner.short_name != NULL
&& strlen(owner.short_name) >= 2
&& strlen(owner.short_name) < 10) {
sprintf(name, "Meshtastic_%s", owner.short_name);
} else {
sprintf(name, "Meshtastic_%02x%02x", dmac[4], dmac[5]);
}
return name; return name;
} }