1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-14 03:49:52 +03:00

Make switch logging using hardware config

This commit is contained in:
3djc 2019-08-10 12:00:38 +02:00
parent f556b77894
commit 4fd5091657
3 changed files with 51 additions and 78 deletions

View file

@ -241,6 +241,33 @@ char * getGVarString(char * dest, int idx)
return dest;
}
char * getSwitchName(char * dest, swsrc_t idx)
{
div_t swinfo = switchInfo(idx);
if (ZEXIST(g_eeGeneral.switchNames[swinfo.quot])) {
dest += zchar2str(dest, g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME);
// TODO tous zchar2str
}
else {
*dest++ = 'S';
#if defined(PCBX7)
if (swinfo.quot >= 5)
*dest++ = 'H' + swinfo.quot - 5;
else if (swinfo.quot == 4)
#if defined(RADIO_T12)
*dest++ = 'G';
#else
*dest++ = 'F';
#endif
else
*dest++ = 'A'+swinfo.quot;
#else
*dest++ = 'A' + swinfo.quot;
#endif
}
return dest;
}
char * getSwitchString(char * dest, swsrc_t idx)
{
if (idx == SWSRC_NONE) {
@ -267,27 +294,7 @@ char * getSwitchString(char * dest, swsrc_t idx)
#define IDX_ON_IN_STR_VSWITCHES (IDX_TRIMS_IN_STR_VSWITCHES+SWSRC_LAST_TRIM-SWSRC_FIRST_TRIM+1)
if (idx <= SWSRC_LAST_SWITCH) {
div_t swinfo = switchInfo(idx);
if (ZEXIST(g_eeGeneral.switchNames[swinfo.quot])) {
s += zchar2str(s, g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME);
// TODO tous zchar2str
}
else {
*s++ = 'S';
#if defined(PCBX7)
if (swinfo.quot >= 5)
*s++ = 'H' + swinfo.quot - 5;
else if (swinfo.quot == 4)
#if defined(RADIO_T12)
*s++ = 'G';
#else
*s++ = 'F';
#endif
else
*s++ = 'A'+swinfo.quot;
#else
*s++ = 'A' + swinfo.quot;
#endif
}
s = getSwitchName(s, idx);
*s++ = "\300-\301"[swinfo.rem];
*s = '\0';
}