Fix rendering of BFO

This commit is contained in:
Reed Nightingale 2020-01-14 22:47:53 -08:00
parent 9a205522d9
commit 9a2a25abe9

View File

@ -80,11 +80,27 @@ void printCarrierFreq(unsigned long freq){
ultoa(freq, b, DEC); ultoa(freq, b, DEC);
strncat(c, b, 2); unsigned int characters_remaining = strlen(b);
strcat_P(c,(const char*)F(".")); char* destination = c;
strncat(c, &b[2], 3); char* source = b;
strcat_P(c,(const char*)F(".")); while(characters_remaining > 0){
strncat(c, &b[5], 1); if(characters_remaining > 3){
unsigned int characters_to_read = characters_remaining % 3;
if(0 == characters_to_read){
characters_to_read = 3;
}
memcpy(destination,source,characters_to_read);
source += characters_to_read;
destination += characters_to_read;
characters_remaining -= characters_to_read;
memcpy_P(destination,(const char*)F("."),1);
destination += 1;
}
else{
memcpy(destination,source,characters_remaining);
characters_remaining -= characters_remaining;
}
}
displayText(c, LAYOUT_SETTING_VALUE_X, LAYOUT_SETTING_VALUE_Y, LAYOUT_SETTING_VALUE_WIDTH, LAYOUT_SETTING_VALUE_HEIGHT, COLOR_TEXT, COLOR_TITLE_BACKGROUND, COLOR_BACKGROUND); displayText(c, LAYOUT_SETTING_VALUE_X, LAYOUT_SETTING_VALUE_Y, LAYOUT_SETTING_VALUE_WIDTH, LAYOUT_SETTING_VALUE_HEIGHT, COLOR_TEXT, COLOR_TITLE_BACKGROUND, COLOR_BACKGROUND);
} }