1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-24 00:35:14 +03:00

Wismy/bt name fix (#6511)

Change bluetooth name to lowercase
This commit is contained in:
WismyYao 2019-06-17 04:58:13 -05:00 committed by Bertrand Songis
parent 76a21f9160
commit 196da35c6e
3 changed files with 14 additions and 8 deletions

View file

@ -311,12 +311,12 @@ void Bluetooth::wakeup(void)
uint8_t len = ZLEN(g_eeGeneral.bluetoothName); uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
if (len > 0) { if (len > 0) {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
*cur++ = zchar2char(g_eeGeneral.bluetoothName[i]); *cur++ = char2lower(zchar2char(g_eeGeneral.bluetoothName[i]));
} }
*cur = '\0'; *cur = '\0';
} }
else { else {
cur = strAppend(cur, "Taranis-X9E"); cur = strAppend(cur, FLAVOUR);
} }
writeString(command); writeString(command);
state = BLUETOOTH_WAIT_TTM; state = BLUETOOTH_WAIT_TTM;
@ -414,16 +414,12 @@ void Bluetooth::wakeup()
uint8_t len = ZLEN(g_eeGeneral.bluetoothName); uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
if (len > 0) { if (len > 0) {
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
*cur++ = zchar2char(g_eeGeneral.bluetoothName[i]); *cur++ = char2lower(zchar2char(g_eeGeneral.bluetoothName[i]));
} }
*cur = '\0'; *cur = '\0';
} }
else { else {
#if defined(PCBHORUS) cur = strAppend(cur, FLAVOUR);
cur = strAppend(cur, "Horus");
#else
cur = strAppend(cur, "Taranis");
#endif
} }
writeString(command); writeString(command);
state = BLUETOOTH_STATE_NAME_SENT; state = BLUETOOTH_STATE_NAME_SENT;

View file

@ -433,6 +433,7 @@ extern struct t_inactivity inactivity;
char hex2zchar(uint8_t hex); char hex2zchar(uint8_t hex);
char zchar2char(int8_t idx); char zchar2char(int8_t idx);
char char2lower(char c);
int8_t char2zchar(char c); int8_t char2zchar(char c);
void str2zchar(char *dest, const char *src, int size); void str2zchar(char *dest, const char *src, int size);
int zchar2str(char *dest, const char *src, int size); int zchar2str(char *dest, const char *src, int size);

View file

@ -44,6 +44,15 @@ char zchar2char(int8_t idx)
return ' '; return ' ';
} }
char char2lower(char c)
{
if(c >= 'A' && c <= 'Z'){
return c+32;
}
else
return c;
}
int8_t char2zchar(char c) int8_t char2zchar(char c)
{ {
if (c == '_') return 37; if (c == '_') return 37;