Skip to content

Commit

Permalink
Merge pull request opentx#5161 from opentx/3djc/Timer-name-handling
Browse files Browse the repository at this point in the history
Timer name handling
  • Loading branch information
3djc authored Aug 15, 2017
2 parents a167e9f + 8cb7031 commit 019e2ae
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
10 changes: 9 additions & 1 deletion radio/src/gui/128x64/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,9 +914,17 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else if (idx <= MIXSRC_LAST_GVAR) {
drawStringWithIndex(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
}
else if (idx < MIXSRC_FIRST_TELEM) {
else if (idx < MIXSRC_FIRST_TIMER) {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS, att);
}
else if (idx <= MIXSRC_LAST_TIMER) {
if(ZEXIST(g_model.timers[idx-MIXSRC_FIRST_TIMER].name)) {
lcdDrawSizedText(x, y, g_model.timers[idx-MIXSRC_FIRST_TIMER].name, LEN_TIMER_NAME, ZCHAR|att);
}
else {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS, att);
}
}
else {
idx -= MIXSRC_FIRST_TELEM;
div_t qr = div(idx, 3);
Expand Down
10 changes: 9 additions & 1 deletion radio/src/gui/212x64/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,17 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
else if (idx <= MIXSRC_LAST_GVAR) {
drawStringWithIndex(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
}
else if (idx < MIXSRC_FIRST_TELEM) {
else if (idx < MIXSRC_FIRST_TIMER) {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS, att);
}
else if (idx <= MIXSRC_LAST_TIMER) {
if(ZEXIST(g_model.timers[idx-MIXSRC_FIRST_TIMER].name)) {
lcdDrawSizedText(x, y, g_model.timers[idx-MIXSRC_FIRST_TIMER].name, LEN_TIMER_NAME, ZCHAR|att);
}
else {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS, att);
}
}
else {
idx -= MIXSRC_FIRST_TELEM;
div_t qr = div(idx, 3);
Expand Down
11 changes: 10 additions & 1 deletion radio/src/strhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,18 @@ char * getSourceString(char * dest, mixsrc_t idx)
else if (idx <= MIXSRC_LAST_GVAR) {
strAppendStringWithIndex(dest, STR_GV, idx - MIXSRC_GVAR1 + 1);
}
else if (idx < MIXSRC_FIRST_TELEM) {
else if (idx < MIXSRC_FIRST_TIMER) {
getStringAtIndex(dest, STR_VSRCRAW, idx-MIXSRC_Rud+1-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS);
}
else if (idx <= MIXSRC_LAST_TIMER) {
if(ZEXIST(g_model.timers[idx-MIXSRC_FIRST_TIMER].name)) {
zchar2str(dest,g_model.timers[idx-MIXSRC_FIRST_TIMER].name, LEN_TIMER_NAME);
dest[LEN_TIMER_NAME] = '\0';
}
else {
getStringAtIndex(dest, STR_VSRCRAW, idx-MIXSRC_Rud+1-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS);
}
}
else {
idx -= MIXSRC_FIRST_TELEM;
div_t qr = div(idx, 3);
Expand Down

0 comments on commit 019e2ae

Please sign in to comment.