diff --git a/meson.build b/meson.build index d84da943..7224690e 100644 --- a/meson.build +++ b/meson.build @@ -290,16 +290,16 @@ linux_def += openrtx_def # Standard UI # linux_default_src = linux_src + ui_src_default -linux_default_def = linux_def + {'SCREEN_WIDTH': '160', 'SCREEN_HEIGHT': '128', 'PIX_FMT_RGB565': '', +linux_default_def = linux_def + {'CONFIG_SCREEN_WIDTH': '160', 'CONFIG_SCREEN_HEIGHT': '128', 'CONFIG_PIX_FMT_RGB565': '', 'GPS_PRESENT': '', 'RTC_PRESENT': ''} -linux_small_def = linux_def + {'SCREEN_WIDTH': '128', 'SCREEN_HEIGHT': '64', 'PIX_FMT_BW': '', +linux_small_def = linux_def + {'CONFIG_SCREEN_WIDTH': '128', 'CONFIG_SCREEN_HEIGHT': '64', 'CONFIG_PIX_FMT_BW': '', 'GPS_PRESENT': '', 'RTC_PRESENT': ''} # # Module17 UI # linux_mod17_src = linux_src + ui_src_module17 -linux_mod17_def = linux_def + {'SCREEN_WIDTH': '128', 'SCREEN_HEIGHT': '64', 'PIX_FMT_BW': ''} +linux_mod17_def = linux_def + {'CONFIG_SCREEN_WIDTH': '128', 'CONFIG_SCREEN_HEIGHT': '64', 'CONFIG_PIX_FMT_BW': ''} linux_c_args = ['-ffunction-sections', '-fdata-sections'] linux_cpp_args = ['-ffunction-sections', '-fdata-sections', '-std=c++14'] diff --git a/openrtx/include/core/graphics.h b/openrtx/include/core/graphics.h index aa079d08..f633f659 100644 --- a/openrtx/include/core/graphics.h +++ b/openrtx/include/core/graphics.h @@ -41,7 +41,7 @@ extern "C" { *********************** HOW TO MANAGE FRAMEBUFFER ***************************** * * This driver allocates the framebuffer as a block of linearly addressed memory - * equivalent to an array of SCREEN_HEIGHT*SCREEN_WIDTH elements. + * equivalent to an array of CONFIG_SCREEN_HEIGHT*CONFIG_SCREEN_WIDTH elements. * With respect to it, screen is indexed in this way: * * (0,0) @@ -53,7 +53,7 @@ extern "C" { * y * * then to set the value of the pixel having coordinates (X,Y), framebuffer has - * to be indexed in this way: buf[X + Y*SCREEN_WIDTH]. + * to be indexed in this way: buf[X + Y*CONFIG_SCREEN_WIDTH]. * */ diff --git a/openrtx/include/core/settings.h b/openrtx/include/core/settings.h index 51916bf8..c92a206c 100644 --- a/openrtx/include/core/settings.h +++ b/openrtx/include/core/settings.h @@ -68,25 +68,25 @@ __attribute__((packed)) settings_t; static const settings_t default_settings = { - 100, // Brightness -#ifdef SCREEN_CONTRAST - DEFAULT_CONTRAST, // Contrast + 100, // Brightness +#ifdef CONFIG_SCREEN_CONTRAST + CONFIG_DEFAULT_CONTRAST, // Contrast #else - 255, // Contrast + 255, // Contrast #endif - 4, // Squelch level, 4 = S3 - 0, // Vox level - 0, // UTC Timezone - false, // GPS enabled - "", // Empty callsign - TIMER_30S, // 30 seconds - 0, // M17 CAN - 0, // Voice prompts off - 0, // Phonetic spell off - 1, // Automatic latch of macro menu enabled - 0, // not used - false, // Check M17 CAN on RX - "" // Empty M17 destination + 4, // Squelch level, 4 = S3 + 0, // Vox level + 0, // UTC Timezone + false, // GPS enabled + "", // Empty callsign + TIMER_30S, // 30 seconds + 0, // M17 CAN + 0, // Voice prompts off + 0, // Phonetic spell off + 1, // Automatic latch of macro menu enabled + 0, // not used + false, // Check M17 CAN on RX + "" // Empty M17 destination }; #endif /* SETTINGS_H */ diff --git a/openrtx/include/interfaces/display.h b/openrtx/include/interfaces/display.h index 4e1ce25b..2cb7d7ba 100644 --- a/openrtx/include/interfaces/display.h +++ b/openrtx/include/interfaces/display.h @@ -32,7 +32,7 @@ extern "C" { *********************** HOW TO MANAGE FRAMEBUFFER ***************************** * * This driver allocates the framebuffer as a block of linearly addressed memory - * equivalent to an array of SCREEN_HEIGHT*SCREEN_WIDTH elements. + * equivalent to an array of CONFIG_SCREEN_HEIGHT*CONFIG_SCREEN_WIDTH elements. * With respect to it, screen is indexed in this way: * * (0,0) @@ -44,7 +44,7 @@ extern "C" { * y * * then to set the value of the pixel having coordinates (X,Y), framebuffer has - * to be indexed in this way: buf[X + Y*SCREEN_WIDTH]. + * to be indexed in this way: buf[X + Y*CONFIG_SCREEN_WIDTH]. * */ diff --git a/openrtx/include/ui/ui_default.h b/openrtx/include/ui/ui_default.h index 508722c8..0dc97690 100644 --- a/openrtx/include/ui/ui_default.h +++ b/openrtx/include/ui/ui_default.h @@ -111,10 +111,10 @@ enum backupRestoreItems enum displayItems { -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS D_BRIGHTNESS = 0, #endif -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST D_CONTRAST, #endif D_TIMER, diff --git a/openrtx/include/ui/ui_mod17.h b/openrtx/include/ui/ui_mod17.h index d2048389..9e725b54 100644 --- a/openrtx/include/ui/ui_mod17.h +++ b/openrtx/include/ui/ui_mod17.h @@ -108,11 +108,11 @@ enum backupRestoreItems enum displayItems { -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST D_CONTRAST = 0 ,D_TIMER #endif -#ifndef SCREEN_CONTRAST +#ifndef CONFIG_SCREEN_CONTRAST D_TIMER = 0 #endif }; diff --git a/openrtx/src/core/graphics.c b/openrtx/src/core/graphics.c index f4703bd5..c13ae793 100644 --- a/openrtx/src/core/graphics.c +++ b/openrtx/src/core/graphics.c @@ -90,7 +90,7 @@ static const GFXfont fonts[] = { TomThumb, // 5pt Symbols8pt7b // 8pt }; -#ifdef PIX_FMT_RGB565 +#ifdef CONFIG_PIX_FMT_RGB565 /* This specialization is meant for an RGB565 little endian pixel format. * Thus, to accomodate for the endianness, the fields in struct rgb565_t have to @@ -120,7 +120,7 @@ static rgb565_t _true2highColor(color_t true_color) return high_color; } -#elif defined PIX_FMT_BW +#elif defined CONFIG_PIX_FMT_BW /** * This specialization is meant for black and white pixel format. @@ -163,12 +163,12 @@ void gfx_init() initialized = 1; // Calculate framebuffer size -#ifdef PIX_FMT_RGB565 - fbSize = SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(PIXEL_T); -#elif defined PIX_FMT_BW - fbSize = (SCREEN_HEIGHT * SCREEN_WIDTH) / 8; +#ifdef CONFIG_PIX_FMT_RGB565 + fbSize = CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH * sizeof(PIXEL_T); +#elif defined CONFIG_PIX_FMT_BW + fbSize = (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8; /* Compensate for eventual truncation error in division */ - if((fbSize * 8) < (SCREEN_HEIGHT * SCREEN_WIDTH)) fbSize += 1; + if((fbSize * 8) < (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH)) fbSize += 1; fbSize *= sizeof(uint8_t); #endif // Clear text buffer @@ -200,8 +200,8 @@ void gfx_clearRows(uint8_t startRow, uint8_t endRow) { if(!initialized) return; if(endRow < startRow) return; - uint16_t start = startRow * SCREEN_WIDTH * sizeof(PIXEL_T); - uint16_t height = endRow - startRow * SCREEN_WIDTH * sizeof(PIXEL_T); + uint16_t start = startRow * CONFIG_SCREEN_WIDTH * sizeof(PIXEL_T); + uint16_t height = endRow - startRow * CONFIG_SCREEN_WIDTH * sizeof(PIXEL_T); // Set the specified rows to 0x00 = make the screen black memset(buf + start, 0x00, height); } @@ -216,9 +216,9 @@ void gfx_clearScreen() void gfx_fillScreen(color_t color) { if(!initialized) return; - for(int16_t y = 0; y < SCREEN_HEIGHT; y++) + for(int16_t y = 0; y < CONFIG_SCREEN_HEIGHT; y++) { - for(int16_t x = 0; x < SCREEN_WIDTH; x++) + for(int16_t x = 0; x < CONFIG_SCREEN_WIDTH; x++) { point_t pos = {x, y}; gfx_setPixel(pos, color); @@ -228,33 +228,33 @@ void gfx_fillScreen(color_t color) inline void gfx_setPixel(point_t pos, color_t color) { - if (pos.x >= SCREEN_WIDTH || pos.y >= SCREEN_HEIGHT - || pos.x < 0 || pos.y < 0) + if (pos.x >= CONFIG_SCREEN_WIDTH || pos.y >= CONFIG_SCREEN_HEIGHT || + pos.x < 0 || pos.y < 0) return; // off the screen -#ifdef PIX_FMT_RGB565 +#ifdef CONFIG_PIX_FMT_RGB565 // Blend old pixel value and new one if (color.alpha < 255) { uint8_t alpha = color.alpha; rgb565_t new_pixel = _true2highColor(color); - rgb565_t old_pixel = buf[pos.x + pos.y*SCREEN_WIDTH]; + rgb565_t old_pixel = buf[pos.x + pos.y*CONFIG_SCREEN_WIDTH]; rgb565_t pixel; pixel.r = ((255-alpha)*old_pixel.r+alpha*new_pixel.r)/255; pixel.g = ((255-alpha)*old_pixel.g+alpha*new_pixel.g)/255; pixel.b = ((255-alpha)*old_pixel.b+alpha*new_pixel.b)/255; - buf[pos.x + pos.y*SCREEN_WIDTH] = pixel; + buf[pos.x + pos.y*CONFIG_SCREEN_WIDTH] = pixel; } else { - buf[pos.x + pos.y*SCREEN_WIDTH] = _true2highColor(color); + buf[pos.x + pos.y*CONFIG_SCREEN_WIDTH] = _true2highColor(color); } -#elif defined PIX_FMT_BW +#elif defined CONFIG_PIX_FMT_BW // Ignore more than half transparent pixels if (color.alpha >= 128) { - uint16_t cell = (pos.x + pos.y*SCREEN_WIDTH) / 8; - uint16_t elem = (pos.x + pos.y*SCREEN_WIDTH) % 8; + uint16_t cell = (pos.x + pos.y*CONFIG_SCREEN_WIDTH) / 8; + uint16_t elem = (pos.x + pos.y*CONFIG_SCREEN_WIDTH) % 8; buf[cell] &= ~(1 << elem); buf[cell] |= (_color2bw(color) << elem); } @@ -329,8 +329,8 @@ void gfx_drawRect(point_t start, uint16_t width, uint16_t height, color_t color, uint16_t x_max = start.x + width - 1; uint16_t y_max = start.y + height - 1; bool perimeter = 0; - if(x_max > (SCREEN_WIDTH - 1)) x_max = SCREEN_WIDTH - 1; - if(y_max > (SCREEN_HEIGHT - 1)) y_max = SCREEN_HEIGHT - 1; + if(x_max > (CONFIG_SCREEN_WIDTH - 1)) x_max = CONFIG_SCREEN_WIDTH - 1; + if(y_max > (CONFIG_SCREEN_HEIGHT - 1)) y_max = CONFIG_SCREEN_HEIGHT - 1; for(int16_t y = start.y; y <= y_max; y++) { for(int16_t x = start.x; x <= x_max; x++) @@ -409,13 +409,13 @@ void gfx_drawCircle(point_t start, uint16_t r, color_t color) void gfx_drawHLine(int16_t y, uint16_t height, color_t color) { point_t start = {0, y}; - gfx_drawRect(start, SCREEN_WIDTH, height, color, 1); + gfx_drawRect(start, CONFIG_SCREEN_WIDTH, height, color, 1); } void gfx_drawVLine(int16_t x, uint16_t width, color_t color) { point_t start = {x, 0}; - gfx_drawRect(start, width, SCREEN_HEIGHT, color, 1); + gfx_drawRect(start, width, CONFIG_SCREEN_HEIGHT, color, 1); } /** @@ -430,7 +430,7 @@ static inline uint16_t get_line_size(GFXfont f, const char *text, uint16_t lengt for(unsigned i = 0; i < length && text[i] != '\n' && text[i] != '\r'; i++) { GFXglyph glyph = f.glyph[text[i] - f.first]; - if (line_size + glyph.xAdvance < SCREEN_WIDTH) + if (line_size + glyph.xAdvance < CONFIG_SCREEN_WIDTH) line_size += glyph.xAdvance; else break; @@ -452,9 +452,9 @@ static inline uint16_t get_reset_x(textAlign_t alignment, uint16_t line_size, case TEXT_ALIGN_LEFT: return startx; case TEXT_ALIGN_CENTER: - return (SCREEN_WIDTH - line_size)/2; + return (CONFIG_SCREEN_WIDTH - line_size)/2; case TEXT_ALIGN_RIGHT: - return SCREEN_WIDTH - line_size - startx; + return CONFIG_SCREEN_WIDTH - line_size - startx; } return 0; @@ -518,7 +518,7 @@ point_t gfx_printBuffer(point_t start, fontSize_t size, textAlign_t alignment, } // Handle wrap around - if (start.x + glyph.xAdvance > SCREEN_WIDTH) + if (start.x + glyph.xAdvance > CONFIG_SCREEN_WIDTH) { // Compute size of the first row in pixels line_size = get_line_size(f, buf, len); @@ -538,8 +538,8 @@ point_t gfx_printBuffer(point_t start, fontSize_t size, textAlign_t alignment, if (bits & 0x80) { - if (start.y + yo + yy < SCREEN_HEIGHT && - start.x + xo + xx < SCREEN_WIDTH && + if (start.y + yo + yy < CONFIG_SCREEN_HEIGHT && + start.x + xo + xx < CONFIG_SCREEN_WIDTH && start.y + yo + yy > 0 && start.x + xo + xx > 0) { @@ -589,8 +589,8 @@ point_t gfx_printLine(uint8_t cur, uint8_t tot, int16_t startY, int16_t endY, // Estimate font height by reading the gliph | height uint8_t fontH = gfx_getFontHeight(size); - // If endY is 0 set it to default value = SCREEN_HEIGHT - if(endY == 0) endY = SCREEN_HEIGHT; + // If endY is 0 set it to default value = CONFIG_SCREEN_HEIGHT + if(endY == 0) endY = CONFIG_SCREEN_HEIGHT; // Calculate print coordinates int16_t height = endY - startY; @@ -610,15 +610,15 @@ void gfx_printError(const char *text, fontSize_t size) uint16_t box_padding = 16; color_t white = {255, 255, 255, 255}; color_t red = {255, 0, 0, 255}; - point_t start = {0, SCREEN_HEIGHT/2 + 5}; + point_t start = {0, CONFIG_SCREEN_HEIGHT/2 + 5}; // Print the error message point_t text_size = gfx_print(start, size, TEXT_ALIGN_CENTER, white, text); text_size.x += box_padding; text_size.y += box_padding; point_t box_start = {0, 0}; - box_start.x = (SCREEN_WIDTH / 2) - (text_size.x / 2); - box_start.y = (SCREEN_HEIGHT / 2) - (text_size.y / 2); + box_start.x = (CONFIG_SCREEN_WIDTH / 2) - (text_size.x / 2); + box_start.y = (CONFIG_SCREEN_HEIGHT / 2) - (text_size.y / 2); // Draw the error box gfx_drawRect(box_start, text_size.x, text_size.y, red, false); } @@ -671,7 +671,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height, // Cap percentage to 1 percentage = (percentage > 100) ? 100 : percentage; -#ifdef PIX_FMT_RGB565 +#ifdef CONFIG_PIX_FMT_RGB565 color_t green = {0, 255, 0 , 255}; color_t yellow = {250, 180, 19 , 255}; color_t red = {255, 0, 0 , 255}; @@ -682,7 +682,7 @@ void gfx_drawBattery(point_t start, uint16_t width, uint16_t height, bat_color = red; else if (percentage > 60) bat_color = green; -#elif defined PIX_FMT_BW +#elif defined CONFIG_PIX_FMT_BW color_t bat_color = white; #endif @@ -1012,8 +1012,8 @@ void gfx_plotData(point_t start, uint16_t width, uint16_t height, pos.x = horizontal_pos; pos.y = start.y + (height / 2) + ((data[i] * 4) / (2 * SHRT_MAX) * height); - if (pos.y > SCREEN_HEIGHT) - pos.y = SCREEN_HEIGHT; + if (pos.y > CONFIG_SCREEN_HEIGHT) + pos.y = CONFIG_SCREEN_HEIGHT; if (!first_iteration) gfx_drawLine(prev_pos, pos, white); prev_pos = pos; diff --git a/openrtx/src/core/openrtx.c b/openrtx/src/core/openrtx.c index 98994faa..9fd4b521 100644 --- a/openrtx/src/core/openrtx.c +++ b/openrtx/src/core/openrtx.c @@ -47,7 +47,7 @@ void openrtx_init() kbd_init(); // Initialize keyboard driver ui_init(); // Initialize user interface vp_init(); // Initialize voice prompts - #ifdef SCREEN_CONTRAST + #ifdef CONFIG_SCREEN_CONTRAST display_setContrast(state.settings.contrast); #endif diff --git a/openrtx/src/ui/default/ui.c b/openrtx/src/ui/default/ui.c index 8f85e3b8..97d7c997 100644 --- a/openrtx/src/ui/default/ui.c +++ b/openrtx/src/ui/default/ui.c @@ -147,10 +147,10 @@ const char *settings_items[] = const char *display_items[] = { -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS "Brightness", #endif -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST "Contrast", #endif "Timer" @@ -294,7 +294,7 @@ static layout_t _ui_calculateLayout() // Calculate UI layout depending on vertical resolution // Tytera MD380, MD-UV380 - #if SCREEN_HEIGHT > 127 + #if CONFIG_SCREEN_HEIGHT > 127 // Height and padding shown in diagram at beginning of file const uint16_t top_h = 16; @@ -338,7 +338,7 @@ static layout_t _ui_calculateLayout() const fontSize_t mode_font_small = FONT_SIZE_9PT; // Radioddity GD-77 - #elif SCREEN_HEIGHT > 63 + #elif CONFIG_SCREEN_HEIGHT > 63 // Height and padding shown in diagram at beginning of file const uint16_t top_h = 11; @@ -381,7 +381,7 @@ static layout_t _ui_calculateLayout() const fontSize_t mode_font_small = FONT_SIZE_6PT; // Radioddity RD-5R - #elif SCREEN_HEIGHT > 47 + #elif CONFIG_SCREEN_HEIGHT > 47 // Height and padding shown in diagram at beginning of file const uint16_t top_h = 11; @@ -430,7 +430,7 @@ static layout_t _ui_calculateLayout() point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - small_line_v_pad - text_v_offset}; point_t line4_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h - small_line_v_pad - text_v_offset}; point_t line3_large_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_large_h - big_line_v_pad - text_v_offset}; - point_t bottom_pos = {horizontal_pad, SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset}; + point_t bottom_pos = {horizontal_pad, CONFIG_SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset}; layout_t new_layout = { @@ -477,12 +477,12 @@ static layout_t _ui_calculateLayout() static void _ui_drawLowBatteryScreen() { gfx_clearScreen(); - uint16_t bat_width = SCREEN_WIDTH / 2; - uint16_t bat_height = SCREEN_HEIGHT / 3; - point_t bat_pos = {SCREEN_WIDTH / 4, SCREEN_HEIGHT / 8}; + uint16_t bat_width = CONFIG_SCREEN_WIDTH / 2; + uint16_t bat_height = CONFIG_SCREEN_HEIGHT / 3; + point_t bat_pos = {CONFIG_SCREEN_WIDTH / 4, CONFIG_SCREEN_HEIGHT / 8}; gfx_drawBattery(bat_pos, bat_width, bat_height, 10); - point_t text_pos_1 = {0, SCREEN_HEIGHT * 2 / 3}; - point_t text_pos_2 = {0, SCREEN_HEIGHT * 2 / 3 + 16}; + point_t text_pos_1 = {0, CONFIG_SCREEN_HEIGHT * 2 / 3}; + point_t text_pos_2 = {0, CONFIG_SCREEN_HEIGHT * 2 / 3 + 16}; gfx_print(text_pos_1, FONT_SIZE_6PT, @@ -516,11 +516,11 @@ static void _ui_timedate_add_digit(datetime_t *timedate, uint8_t pos, vp_queuePrompt(PROMPT_SLASH); // just indicates separation of date and time. if (pos==6) // start of time. - vp_queueString("hh:mm", vpAnnounceCommonSymbols|vpAnnounceLessCommonSymbols); + vp_queueString("hh:mm", vpAnnounceCommonSymbols|vpAnnounceLessCommonSymbols); if (pos == 8) vp_queuePrompt(PROMPT_COLON); vp_play(); - + switch(pos) { // Set date @@ -593,7 +593,7 @@ static bool _ui_drawDarkOverlay() { color_t alpha_grey = {0, 0, 0, 255}; point_t origin = {0, 0}; - gfx_drawRect(origin, SCREEN_WIDTH, SCREEN_HEIGHT, alpha_grey, true); + gfx_drawRect(origin, CONFIG_SCREEN_WIDTH, CONFIG_SCREEN_HEIGHT, alpha_grey, true); return true; } @@ -736,7 +736,7 @@ static void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx) vp_play(); } -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS static void _ui_changeBrightness(int variation) { state.settings.brightness += variation; @@ -750,7 +750,7 @@ static void _ui_changeBrightness(int variation) } #endif -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST static void _ui_changeContrast(int variation) { if(variation >= 0) @@ -996,7 +996,7 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) float power = dBmToWatt(state.channel.power); vp_anouncePower(power, queueFlags); break; -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS case 7: _ui_changeBrightness(-5); vp_announceSettingsInt(¤tLanguage->brightness, queueFlags, @@ -1011,7 +1011,7 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx) case 9: if (!ui_state.input_locked) ui_state.input_locked = true; - else + else ui_state.input_locked = false; break; } @@ -1148,8 +1148,8 @@ static void _ui_textInputDel(char *buf) { // announce the char about to be backspaced. // Note this assumes editing callsign. - // If we edit a different buffer which allows the underline char, we may - // not want to exclude it, but when editing callsign, we do not want to say + // If we edit a different buffer which allows the underline char, we may + // not want to exclude it, but when editing callsign, we do not want to say // underline since it means the field is empty. if(buf[ui_state.input_position] && buf[ui_state.input_position]!='_') @@ -1225,7 +1225,7 @@ static void _ui_numberInputDel(uint32_t *num) { // announce the digit about to be backspaced. vp_announceInputChar('0' + *num % 10); - + // Move back input cursor if(ui_state.input_position > 0) ui_state.input_position--; @@ -1251,14 +1251,14 @@ void ui_drawSplashScreen() { gfx_clearScreen(); - #if SCREEN_HEIGHT > 64 - static const point_t logo_orig = {0, (SCREEN_HEIGHT / 2) - 6}; - static const point_t call_orig = {0, SCREEN_HEIGHT - 8}; + #if CONFIG_SCREEN_HEIGHT > 64 + static const point_t logo_orig = {0, (CONFIG_SCREEN_HEIGHT / 2) - 6}; + static const point_t call_orig = {0, CONFIG_SCREEN_HEIGHT - 8}; static const fontSize_t logo_font = FONT_SIZE_12PT; static const fontSize_t call_font = FONT_SIZE_8PT; #else static const point_t logo_orig = {0, 19}; - static const point_t call_orig = {0, SCREEN_HEIGHT - 8}; + static const point_t call_orig = {0, CONFIG_SCREEN_HEIGHT - 8}; static const fontSize_t logo_font = FONT_SIZE_8PT; static const fontSize_t call_font = FONT_SIZE_6PT; #endif @@ -1285,57 +1285,57 @@ static uint32_t vpGPSLastUpdate = 0; static vpGPSInfoFlags_t GetGPSDirectionOrSpeedChanged() { - if (!state.settings.gps_enabled) + if (!state.settings.gps_enabled) return vpGPSNone; - + uint32_t now = getTick(); if (now - vpGPSLastUpdate < 8000) return vpGPSNone; - + vpGPSInfoFlags_t whatChanged= vpGPSNone; - + if (state.gps_data.fix_quality != priorGPSFixQuality) { whatChanged |= vpGPSFixQuality; priorGPSFixQuality= state.gps_data.fix_quality; } - + if (state.gps_data.fix_type != priorGPSFixType) { whatChanged |= vpGPSFixType; priorGPSFixType = state.gps_data.fix_type; } - + float speedDiff=fabs(state.gps_data.speed - priorGPSSpeed); if (speedDiff >= 1) { whatChanged |= vpGPSSpeed; priorGPSSpeed = state.gps_data.speed; } - + float altitudeDiff = fabs(state.gps_data.altitude - priorGPSAltitude); if (altitudeDiff >= 5) { whatChanged |= vpGPSAltitude; priorGPSAltitude = state.gps_data.altitude; } - + float degreeDiff = fabs(state.gps_data.tmg_true - priorGPSDirection); if (degreeDiff >= 1) { whatChanged |= vpGPSDirection; priorGPSDirection = state.gps_data.tmg_true; } - + if (state.gps_data.satellites_in_view != priorSatellitesInView) { whatChanged |= vpGPSSatCount; priorSatellitesInView = state.gps_data.satellites_in_view; } - + if (whatChanged) vpGPSLastUpdate=now; - + return whatChanged; } #endif // GPS_PRESENT @@ -1460,7 +1460,7 @@ void ui_updateFSM(bool *sync_rtx) strncpy(state.settings.m17_dest, ui_state.new_callsign, 10); ui_state.edit_mode = false; *sync_rtx = true; - vp_announceM17Info(NULL, ui_state.edit_mode, + vp_announceM17Info(NULL, ui_state.edit_mode, queueFlags); } else if(msg.keys & KEY_HASH) @@ -1469,7 +1469,7 @@ void ui_updateFSM(bool *sync_rtx) strncpy(state.settings.m17_dest, "", 1); ui_state.edit_mode = false; *sync_rtx = true; - vp_announceM17Info(NULL, ui_state.edit_mode, + vp_announceM17Info(NULL, ui_state.edit_mode, queueFlags); } else if(msg.keys & KEY_ESC) @@ -1581,7 +1581,7 @@ void ui_updateFSM(bool *sync_rtx) vp_announceInputReceiveOrTransmit(false, vpqInit); vp_queueInteger(input_getPressedNumber(msg)); vp_play(); - + ui_state.new_rx_frequency = 0; ui_state.new_tx_frequency = 0; // Save pressed number to calculare frequency and show in GUI @@ -1984,7 +1984,7 @@ void ui_updateFSM(bool *sync_rtx) // Reset input position and selection ui_state.input_position = 0; memset(&ui_state.new_timedate, 0, sizeof(datetime_t)); - vp_announceBuffer(¤tLanguage->timeAndDate, + vp_announceBuffer(¤tLanguage->timeAndDate, true, false, "dd/mm/yy"); } else if(msg.keys & KEY_ESC) @@ -2026,17 +2026,17 @@ void ui_updateFSM(bool *sync_rtx) { switch(ui_state.menu_selected) { -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS case D_BRIGHTNESS: _ui_changeBrightness(-5); - vp_announceSettingsInt(¤tLanguage->brightness, queueFlags, + vp_announceSettingsInt(¤tLanguage->brightness, queueFlags, state.settings.brightness); break; #endif -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST case D_CONTRAST: _ui_changeContrast(-4); - vp_announceSettingsInt(¤tLanguage->brightness, queueFlags, + vp_announceSettingsInt(¤tLanguage->brightness, queueFlags, state.settings.contrast); break; #endif @@ -2053,17 +2053,17 @@ void ui_updateFSM(bool *sync_rtx) { switch(ui_state.menu_selected) { -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS case D_BRIGHTNESS: _ui_changeBrightness(+5); vp_announceSettingsInt(¤tLanguage->brightness, queueFlags, state.settings.brightness); break; #endif -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST case D_CONTRAST: _ui_changeContrast(+4); - vp_announceSettingsInt(¤tLanguage->brightness, queueFlags, + vp_announceSettingsInt(¤tLanguage->brightness, queueFlags, state.settings.contrast); break; #endif @@ -2098,13 +2098,13 @@ void ui_updateFSM(bool *sync_rtx) state.settings.gps_enabled = 0; else state.settings.gps_enabled = 1; - vp_announceSettingsOnOffToggle(¤tLanguage->gpsEnabled, + vp_announceSettingsOnOffToggle(¤tLanguage->gpsEnabled, queueFlags, state.settings.gps_enabled); break; case G_SET_TIME: state.gps_set_time = !state.gps_set_time; - vp_announceSettingsOnOffToggle(¤tLanguage->gpsSetTime, + vp_announceSettingsOnOffToggle(¤tLanguage->gpsSetTime, queueFlags, state.gps_set_time); break; @@ -2418,7 +2418,7 @@ void ui_updateFSM(bool *sync_rtx) vp_announceScreen(state.ui_screen); } // generic beep for any keydown if beep is enabled. - // At vp levels higher than beep, keys will generate voice so no need + // At vp levels higher than beep, keys will generate voice so no need // to beep or you'll get an unwanted click. if ((msg.keys &0xffff) && (state.settings.vpLevel == vpBeep)) vp_beep(BEEP_KEY_GENERIC, SHORT_BEEP); @@ -2429,7 +2429,7 @@ void ui_updateFSM(bool *sync_rtx) else if(event.type == EVENT_STATUS) { #ifdef GPS_PRESENT - if ((state.ui_screen == MENU_GPS) && + if ((state.ui_screen == MENU_GPS) && (!vp_isPlaying()) && (state.settings.vpLevel > vpLow) && (!txOngoing && !rtx_rxSquelchOpen())) diff --git a/openrtx/src/ui/default/ui_main.c b/openrtx/src/ui/default/ui_main.c index 0a6b80cb..97812f8a 100644 --- a/openrtx/src/ui/default/ui_main.c +++ b/openrtx/src/ui/default/ui_main.c @@ -31,7 +31,7 @@ void _ui_drawMainBackground() // Print top bar line of hline_h pixel height gfx_drawHLine(layout.top_h, layout.hline_h, color_grey); // Print bottom bar line of 1 pixel height - gfx_drawHLine(SCREEN_HEIGHT - layout.bottom_h - 1, layout.hline_h, color_grey); + gfx_drawHLine(CONFIG_SCREEN_HEIGHT - layout.bottom_h - 1, layout.hline_h, color_grey); } void _ui_drawMainTop(ui_state_t * ui_state) @@ -50,9 +50,9 @@ void _ui_drawMainTop(ui_state_t * ui_state) color_white,"%.1fV", last_state.v_bat); #else // Otherwise print battery icon on top bar, use 4 px padding - uint16_t bat_width = SCREEN_WIDTH / 9; + uint16_t bat_width = CONFIG_SCREEN_WIDTH / 9; uint16_t bat_height = layout.top_h - (layout.status_v_pad * 2); - point_t bat_pos = {SCREEN_WIDTH - bat_width - layout.horizontal_pad, + point_t bat_pos = {CONFIG_SCREEN_WIDTH - bat_width - layout.horizontal_pad, layout.status_v_pad}; gfx_drawBattery(bat_pos, bat_width, bat_height, last_state.charge); #endif @@ -250,10 +250,10 @@ void _ui_drawMainBottom() float rssi = last_state.rssi; float squelch = last_state.settings.sqlLevel / 16.0f; float volume = platform_getVolumeLevel() / 255.0f; - uint16_t meter_width = SCREEN_WIDTH - 2 * layout.horizontal_pad; + uint16_t meter_width = CONFIG_SCREEN_WIDTH - 2 * layout.horizontal_pad; uint16_t meter_height = layout.bottom_h; point_t meter_pos = { layout.horizontal_pad, - SCREEN_HEIGHT - meter_height - layout.bottom_pad}; + CONFIG_SCREEN_HEIGHT - meter_height - layout.bottom_pad}; uint8_t mic_level = platform_getMicLevel(); switch(last_state.channel.mode) { diff --git a/openrtx/src/ui/default/ui_menu.c b/openrtx/src/ui/default/ui_menu.c index 4a18fda9..af8e0b0c 100644 --- a/openrtx/src/ui/default/ui_menu.c +++ b/openrtx/src/ui/default/ui_menu.c @@ -159,11 +159,11 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_ { point_t pos = layout.line1_pos; // Number of menu entries that fit in the screen height - uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; + uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t scroll = 0; char entry_buf[MAX_ENTRY_LEN] = ""; color_t text_color = color_white; - for(int item=0, result=0; (result == 0) && (pos.y < SCREEN_HEIGHT); item++) + for(int item=0, result=0; (result == 0) && (pos.y < CONFIG_SCREEN_HEIGHT); item++) { // If selection is off the screen, scroll screen if(selected >= entries_in_screen) @@ -178,7 +178,7 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_ text_color = color_black; // Draw rectangle under selected item, compensating for text height point_t rect_pos = {0, pos.y - layout.menu_h + 3}; - gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, true); + gfx_drawRect(rect_pos, CONFIG_SCREEN_WIDTH, layout.menu_h, color_white, true); announceMenuItemIfNeeded(entry_buf, NULL, false); } gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf); @@ -193,12 +193,12 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected, { point_t pos = layout.line1_pos; // Number of menu entries that fit in the screen height - uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; + uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t scroll = 0; char entry_buf[MAX_ENTRY_LEN] = ""; char value_buf[MAX_ENTRY_LEN] = ""; color_t text_color = color_white; - for(int item=0, result=0; (result == 0) && (pos.y < SCREEN_HEIGHT); item++) + for(int item=0, result=0; (result == 0) && (pos.y < CONFIG_SCREEN_HEIGHT); item++) { // If selection is off the screen, scroll screen if(selected >= entries_in_screen) @@ -222,7 +222,7 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected, full_rect = false; } point_t rect_pos = {0, pos.y - layout.menu_h + 3}; - gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, full_rect); + gfx_drawRect(rect_pos, CONFIG_SCREEN_WIDTH, layout.menu_h, color_white, full_rect); bool editModeChanged = priorEditMode != ui_state->edit_mode; priorEditMode = ui_state->edit_mode; // force the menu item to be spoken when the edit mode changes. @@ -270,12 +270,12 @@ int _ui_getDisplayValueName(char *buf, uint8_t max_len, uint8_t index) uint8_t value = 0; switch(index) { -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS case D_BRIGHTNESS: value = last_state.settings.brightness; break; #endif -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST case D_CONTRAST: value = last_state.settings.contrast; break; @@ -602,7 +602,7 @@ void _ui_drawMenuGPS() // Print "GPS" on top bar gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, color_white, currentLanguage->gps); - point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5}; + point_t fix_pos = {layout.line2_pos.x, CONFIG_SCREEN_HEIGHT * 2 / 5}; // Print GPS status, if no fix, hide details if(!last_state.settings.gps_enabled) gfx_print(fix_pos, layout.line3_large_font, TEXT_ALIGN_CENTER, @@ -668,17 +668,17 @@ void _ui_drawMenuGPS() last_state.gps_data.altitude); } // Draw compass - point_t compass_pos = {layout.horizontal_pad * 2, SCREEN_HEIGHT / 2}; + point_t compass_pos = {layout.horizontal_pad * 2, CONFIG_SCREEN_HEIGHT / 2}; gfx_drawGPScompass(compass_pos, - SCREEN_WIDTH / 9 + 2, + CONFIG_SCREEN_WIDTH / 9 + 2, last_state.gps_data.tmg_true, last_state.gps_data.fix_quality != 0 && last_state.gps_data.fix_quality != 6); // Draw satellites bar graph - point_t bar_pos = {layout.line3_large_pos.x + SCREEN_WIDTH * 1 / 3, SCREEN_HEIGHT / 2}; + point_t bar_pos = {layout.line3_large_pos.x + CONFIG_SCREEN_WIDTH * 1 / 3, CONFIG_SCREEN_HEIGHT / 2}; gfx_drawGPSgraph(bar_pos, - (SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad, - SCREEN_HEIGHT / 3, + (CONFIG_SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad, + CONFIG_SCREEN_HEIGHT / 3, last_state.gps_data.satellites, last_state.gps_data.active_sats); } @@ -772,10 +772,10 @@ void _ui_drawMenuAbout() gfx_clearScreen(); point_t logo_pos; - if(SCREEN_HEIGHT >= 100) + if(CONFIG_SCREEN_HEIGHT >= 100) { logo_pos.x = 0; - logo_pos.y = SCREEN_HEIGHT / 5; + logo_pos.y = CONFIG_SCREEN_HEIGHT / 5; gfx_print(logo_pos, FONT_SIZE_12PT, TEXT_ALIGN_CENTER, yellow_fab413, "O P N\nR T X"); } @@ -788,7 +788,7 @@ void _ui_drawMenuAbout() } uint8_t line_h = layout.menu_h; - point_t pos = {SCREEN_WIDTH / 7, SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; + point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; for(int author = 0; author < author_num; author++) { gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT, @@ -887,18 +887,18 @@ void _ui_drawSettingsM17(ui_state_t* ui_state) // Print "M17 Settings" on top bar gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, color_white, currentLanguage->m17settings); - gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(1, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.menu_font, TEXT_ALIGN_LEFT, color_white, currentLanguage->callsign); if((ui_state->edit_mode) && (ui_state->menu_selected == M17_CALLSIGN)) { - uint16_t rect_width = SCREEN_WIDTH - (layout.horizontal_pad * 2); - uint16_t rect_height = (SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; - point_t rect_origin = {(SCREEN_WIDTH - rect_width) / 2, - (SCREEN_HEIGHT - rect_height) / 2}; + uint16_t rect_width = CONFIG_SCREEN_WIDTH - (layout.horizontal_pad * 2); + uint16_t rect_height = (CONFIG_SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; + point_t rect_origin = {(CONFIG_SCREEN_WIDTH - rect_width) / 2, + (CONFIG_SCREEN_HEIGHT - rect_height) / 2}; gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false); // Print M17 callsign being typed - gfx_printLine(1, 1, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(1, 1, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.input_font, TEXT_ALIGN_CENTER, color_white, ui_state->new_callsign); } @@ -933,10 +933,10 @@ void _ui_drawSettingsReset2Defaults(ui_state_t* ui_state) // Make text flash yellow once every 1s color_t textcolor = drawcnt % 2 == 0 ? color_white : yellow_fab413; - gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(1, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.top_font, TEXT_ALIGN_CENTER, textcolor, currentLanguage->toReset); - gfx_printLine(2, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(2, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.top_font, TEXT_ALIGN_CENTER, textcolor, currentLanguage->pressEnterTwice); @@ -961,10 +961,10 @@ void _ui_drawSettingsRadio(ui_state_t* ui_state) if ((ui_state->menu_selected == R_OFFSET) && (ui_state->edit_mode)) { char buf[17] = { 0 }; - uint16_t rect_width = SCREEN_WIDTH - (layout.horizontal_pad * 2); - uint16_t rect_height = (SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; - point_t rect_origin = {(SCREEN_WIDTH - rect_width) / 2, - (SCREEN_HEIGHT - rect_height) / 2}; + uint16_t rect_width = CONFIG_SCREEN_WIDTH - (layout.horizontal_pad * 2); + uint16_t rect_height = (CONFIG_SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; + point_t rect_origin = {(CONFIG_SCREEN_WIDTH - rect_width) / 2, + (CONFIG_SCREEN_HEIGHT - rect_height) / 2}; gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false); @@ -976,7 +976,7 @@ void _ui_drawSettingsRadio(ui_state_t* ui_state) else snprintf(buf, 17, "%gMHz", (float) ui_state->new_offset / 1000000.0f); - gfx_printLine(1, 1, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(1, 1, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.input_font, TEXT_ALIGN_CENTER, color_white, buf); } @@ -1153,7 +1153,7 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) #endif // UI_NO_KEYBOARD gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT, yellow_fab413, "7"); -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT, color_white, " B-"); gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_LEFT, @@ -1166,7 +1166,7 @@ bool _ui_drawMacroMenu(ui_state_t* ui_state) #endif // UI_NO_KEYBOARD gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER, yellow_fab413, "8"); -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS gfx_print(layout.line3_large_pos, layout.top_font, TEXT_ALIGN_CENTER, color_white, " B+"); #endif diff --git a/openrtx/src/ui/module17/ui.c b/openrtx/src/ui/module17/ui.c index a7b5c65c..fecfc4a4 100644 --- a/openrtx/src/ui/module17/ui.c +++ b/openrtx/src/ui/module17/ui.c @@ -88,7 +88,7 @@ const char *settings_items[] = const char *display_items[] = { -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST "Contrast", #endif "Timer" @@ -256,7 +256,7 @@ layout_t _ui_calculateLayout() point_t line3_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h - big_line_v_pad - text_v_offset}; point_t line4_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h - big_line_v_pad - text_v_offset}; point_t line5_pos = {horizontal_pad, top_h + top_pad + line1_h + line2_h + line3_h + line4_h + line5_h - big_line_v_pad - text_v_offset}; - point_t bottom_pos = {horizontal_pad, SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset}; + point_t bottom_pos = {horizontal_pad, CONFIG_SCREEN_HEIGHT - bottom_pad - status_v_pad - text_v_offset}; layout_t new_layout = { @@ -318,7 +318,7 @@ void ui_drawSplashScreen() { gfx_clearScreen(); - point_t origin = {0, (SCREEN_HEIGHT / 2) - 6}; + point_t origin = {0, (CONFIG_SCREEN_HEIGHT / 2) - 6}; gfx_print(origin, FONT_SIZE_12PT, TEXT_ALIGN_CENTER, yellow_fab413, "O P N\nR T X"); } @@ -929,7 +929,7 @@ void ui_updateFSM(bool *sync_rtx) { switch(ui_state.menu_selected) { -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST case D_CONTRAST: _ui_changeContrast(-4); break; @@ -945,7 +945,7 @@ void ui_updateFSM(bool *sync_rtx) { switch(ui_state.menu_selected) { -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST case D_CONTRAST: _ui_changeContrast(+4); break; diff --git a/openrtx/src/ui/module17/ui_main.c b/openrtx/src/ui/module17/ui_main.c index e4465cb8..b2a75d90 100644 --- a/openrtx/src/ui/module17/ui_main.c +++ b/openrtx/src/ui/module17/ui_main.c @@ -30,7 +30,7 @@ void _ui_drawMainBackground() // Print top bar line of hline_h pixel height gfx_drawHLine(layout.top_h, layout.hline_h, color_grey); // Print bottom bar line of 1 pixel height - gfx_drawHLine(SCREEN_HEIGHT - layout.bottom_h - 1, layout.hline_h, color_grey); + gfx_drawHLine(CONFIG_SCREEN_HEIGHT - layout.bottom_h - 1, layout.hline_h, color_grey); } void _ui_drawMainTop() @@ -252,10 +252,10 @@ void _ui_drawMainBottom() float squelch = last_state.settings.sqlLevel / 16.0f; // Module17 0.1e does not know the volume level, so we will never draw it float volume = platform_getVolumeLevel() / 255.0f; - uint16_t meter_width = SCREEN_WIDTH - 2 * layout.horizontal_pad; + uint16_t meter_width = CONFIG_SCREEN_WIDTH - 2 * layout.horizontal_pad; uint16_t meter_height = layout.bottom_h; point_t meter_pos = { layout.horizontal_pad, - SCREEN_HEIGHT - meter_height - layout.bottom_pad}; + CONFIG_SCREEN_HEIGHT - meter_height - layout.bottom_pad}; uint8_t mic_level = platform_getMicLevel(); switch(last_state.channel.mode) { diff --git a/openrtx/src/ui/module17/ui_menu.c b/openrtx/src/ui/module17/ui_menu.c index 50500d59..6c552b60 100644 --- a/openrtx/src/ui/module17/ui_menu.c +++ b/openrtx/src/ui/module17/ui_menu.c @@ -75,11 +75,11 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_ { point_t pos = layout.line1_pos; // Number of menu entries that fit in the screen height - uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; + uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t scroll = 0; char entry_buf[MAX_ENTRY_LEN] = ""; color_t text_color = color_white; - for(int item=0, result=0; (result == 0) && (pos.y < SCREEN_HEIGHT); item++) + for(int item=0, result=0; (result == 0) && (pos.y < CONFIG_SCREEN_HEIGHT); item++) { // If selection is off the screen, scroll screen if(selected >= entries_in_screen) @@ -94,7 +94,7 @@ void _ui_drawMenuList(uint8_t selected, int (*getCurrentEntry)(char *buf, uint8_ text_color = color_black; // Draw rectangle under selected item, compensating for text height point_t rect_pos = {0, pos.y - layout.menu_h + 3}; - gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, true); + gfx_drawRect(rect_pos, CONFIG_SCREEN_WIDTH, layout.menu_h, color_white, true); } gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf); pos.y += layout.menu_h; @@ -108,12 +108,12 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected, { point_t pos = layout.line1_pos; // Number of menu entries that fit in the screen height - uint8_t entries_in_screen = (SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; + uint8_t entries_in_screen = (CONFIG_SCREEN_HEIGHT - 1 - pos.y) / layout.menu_h + 1; uint8_t scroll = 0; char entry_buf[MAX_ENTRY_LEN] = ""; char value_buf[MAX_ENTRY_LEN] = ""; color_t text_color = color_white; - for(int item=0, result=0; (result == 0) && (pos.y < SCREEN_HEIGHT); item++) + for(int item=0, result=0; (result == 0) && (pos.y < CONFIG_SCREEN_HEIGHT); item++) { // If selection is off the screen, scroll screen if(selected >= entries_in_screen) @@ -137,7 +137,7 @@ void _ui_drawMenuListValue(ui_state_t* ui_state, uint8_t selected, full_rect = false; } point_t rect_pos = {0, pos.y - layout.menu_h + 3}; - gfx_drawRect(rect_pos, SCREEN_WIDTH, layout.menu_h, color_white, full_rect); + gfx_drawRect(rect_pos, CONFIG_SCREEN_WIDTH, layout.menu_h, color_white, full_rect); } gfx_print(pos, layout.menu_font, TEXT_ALIGN_LEFT, text_color, entry_buf); gfx_print(pos, layout.menu_font, TEXT_ALIGN_RIGHT, text_color, value_buf); @@ -177,7 +177,7 @@ int _ui_getDisplayValueName(char *buf, uint8_t max_len, uint8_t index) uint8_t value = 0; switch(index) { -#ifdef SCREEN_CONTRAST +#ifdef CONFIG_SCREEN_CONTRAST case D_CONTRAST: value = last_state.settings.contrast; break; @@ -326,7 +326,7 @@ void _ui_drawMenuGPS() // Print "GPS" on top bar gfx_print(layout.top_pos, layout.top_font, TEXT_ALIGN_CENTER, color_white, "GPS"); - point_t fix_pos = {layout.line2_pos.x, SCREEN_HEIGHT * 2 / 5}; + point_t fix_pos = {layout.line2_pos.x, CONFIG_SCREEN_HEIGHT * 2 / 5}; // Print GPS status, if no fix, hide details if(!last_state.settings.gps_enabled) gfx_print(fix_pos, layout.line3_font, TEXT_ALIGN_CENTER, @@ -392,17 +392,17 @@ void _ui_drawMenuGPS() last_state.gps_data.altitude); } // Draw compass - point_t compass_pos = {layout.horizontal_pad * 2, SCREEN_HEIGHT / 2}; + point_t compass_pos = {layout.horizontal_pad * 2, CONFIG_SCREEN_HEIGHT / 2}; gfx_drawGPScompass(compass_pos, - SCREEN_WIDTH / 9 + 2, + CONFIG_SCREEN_WIDTH / 9 + 2, last_state.gps_data.tmg_true, last_state.gps_data.fix_quality != 0 && last_state.gps_data.fix_quality != 6); // Draw satellites bar graph - point_t bar_pos = {layout.line3_pos.x + SCREEN_WIDTH * 1 / 3, SCREEN_HEIGHT / 2}; + point_t bar_pos = {layout.line3_pos.x + CONFIG_SCREEN_WIDTH * 1 / 3, CONFIG_SCREEN_HEIGHT / 2}; gfx_drawGPSgraph(bar_pos, - (SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad, - SCREEN_HEIGHT / 3, + (CONFIG_SCREEN_WIDTH * 2 / 3) - layout.horizontal_pad, + CONFIG_SCREEN_HEIGHT / 3, last_state.gps_data.satellites, last_state.gps_data.active_sats); } @@ -438,7 +438,7 @@ void _ui_drawMenuAbout() "OpenRTX"); uint8_t line_h = layout.menu_h; - point_t pos = {SCREEN_WIDTH / 7, SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; + point_t pos = {CONFIG_SCREEN_WIDTH / 7, CONFIG_SCREEN_HEIGHT - (line_h * (author_num - 1)) - 5}; for(int author = 0; author < author_num; author++) { gfx_print(pos, layout.top_font, TEXT_ALIGN_LEFT, @@ -539,17 +539,17 @@ void _ui_drawSettingsM17(ui_state_t* ui_state) if(ui_state->edit_mode) { - gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(1, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.menu_font, TEXT_ALIGN_LEFT, color_white, "Callsign:"); - // uint16_t rect_width = SCREEN_WIDTH - (layout.horizontal_pad * 2); - // uint16_t rect_height = (SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; - // point_t rect_origin = {(SCREEN_WIDTH - rect_width) / 2, - // (SCREEN_HEIGHT - rect_height) / 2}; + // uint16_t rect_width = CONFIG_SCREEN_WIDTH - (layout.horizontal_pad * 2); + // uint16_t rect_height = (CONFIG_SCREEN_HEIGHT - (layout.top_h + layout.bottom_h))/2; + // point_t rect_origin = {(CONFIG_SCREEN_WIDTH - rect_width) / 2, + // (CONFIG_SCREEN_HEIGHT - rect_height) / 2}; // gfx_drawRect(rect_origin, rect_width, rect_height, color_white, false); // Print M17 callsign being typed - gfx_printLine(1, 1, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(1, 1, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.input_font, TEXT_ALIGN_CENTER, color_white, ui_state->new_callsign); // Print Button Info @@ -589,10 +589,10 @@ void _ui_drawSettingsReset2Defaults(ui_state_t* ui_state) // Make text flash yellow once every 1s color_t textcolor = drawcnt % 2 == 0 ? color_white : yellow_fab413; - gfx_printLine(1, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(1, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.top_font, TEXT_ALIGN_CENTER, textcolor, "To reset:"); - gfx_printLine(2, 4, layout.top_h, SCREEN_HEIGHT - layout.bottom_h, + gfx_printLine(2, 4, layout.top_h, CONFIG_SCREEN_HEIGHT - layout.bottom_h, layout.horizontal_pad, layout.top_font, TEXT_ALIGN_CENTER, textcolor, "Press Enter twice"); diff --git a/platform/drivers/backlight/backlight_MDx.c b/platform/drivers/backlight/backlight_MDx.c index 8a850e77..a8d1c3b9 100644 --- a/platform/drivers/backlight/backlight_MDx.c +++ b/platform/drivers/backlight/backlight_MDx.c @@ -23,7 +23,7 @@ #include #include "backlight.h" -#if defined(PLATFORM_MDUV3x0) && defined(SCREEN_BRIGHTNESS) +#if defined(PLATFORM_MDUV3x0) && defined(CONFIG_SCREEN_BRIGHTNESS) /* * Interrupt-based software PWM for backlight dimming on MD-UV3x0. @@ -83,7 +83,7 @@ void backlight_init() gpio_setMode(LCD_BKLIGHT, OUTPUT); gpio_clearPin(LCD_BKLIGHT); - #ifdef SCREEN_BRIGHTNESS + #ifdef CONFIG_SCREEN_BRIGHTNESS /* * Configure TIM11 for backlight PWM: Fpwm = 256Hz, 8 bit of resolution. * APB2 freq. is 84MHz but timer runs at twice this frequency, then: @@ -146,7 +146,7 @@ void display_setBacklightLevel(uint8_t level) */ if(pwmLevel > 1) { - #ifdef SCREEN_BRIGHTNESS + #ifdef CONFIG_SCREEN_BRIGHTNESS TIM11->CCR1 = pwmLevel; TIM11->CR1 |= TIM_CR1_CEN; #else diff --git a/platform/drivers/display/HX8353_MD3x.cpp b/platform/drivers/display/HX8353_MD3x.cpp index fe30ef40..6203f0a9 100644 --- a/platform/drivers/display/HX8353_MD3x.cpp +++ b/platform/drivers/display/HX8353_MD3x.cpp @@ -92,7 +92,7 @@ * starting at 0x20000000 and accessible by the DMA. * Pixel format is RGB565, 16 bit per pixel. */ -static uint16_t __attribute__((section(".bss2"))) frameBuffer[SCREEN_WIDTH * SCREEN_HEIGHT]; +static uint16_t __attribute__((section(".bss2"))) frameBuffer[CONFIG_SCREEN_WIDTH * CONFIG_SCREEN_HEIGHT]; using namespace miosix; static Thread *lcdWaiting = 0; @@ -132,7 +132,7 @@ void display_init() backlight_init(); /* Clear framebuffer, setting all pixels to 0x00 makes the screen white */ - memset(frameBuffer, 0x00, SCREEN_WIDTH * SCREEN_HEIGHT * sizeof(uint16_t)); + memset(frameBuffer, 0x00, CONFIG_SCREEN_WIDTH * CONFIG_SCREEN_HEIGHT * sizeof(uint16_t)); /* * Turn on DMA2 and configure its interrupt. DMA is used to transfer the @@ -467,9 +467,9 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) */ for(uint8_t y = startRow; y < endRow; y++) { - for(uint8_t x = 0; x < SCREEN_WIDTH; x++) + for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH; x++) { - size_t pos = x + y * SCREEN_WIDTH; + size_t pos = x + y * CONFIG_SCREEN_WIDTH; uint16_t pixel = frameBuffer[pos]; frameBuffer[pos] = __builtin_bswap16(pixel); } @@ -491,8 +491,8 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) * we have to set the transfer size to twice the framebuffer size, since * this one is made of 16 bit variables. */ - DMA2_Stream7->NDTR = (endRow - startRow) * SCREEN_WIDTH * sizeof(uint16_t); - DMA2_Stream7->PAR = ((uint32_t ) frameBuffer + (startRow * SCREEN_WIDTH + DMA2_Stream7->NDTR = (endRow - startRow) * CONFIG_SCREEN_WIDTH * sizeof(uint16_t); + DMA2_Stream7->PAR = ((uint32_t ) frameBuffer + (startRow * CONFIG_SCREEN_WIDTH * sizeof(uint16_t))); DMA2_Stream7->M0AR = LCD_FSMC_ADDR_DATA; DMA2_Stream7->CR = DMA_SxCR_CHSEL /* Channel 7 */ @@ -521,7 +521,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) void display_render() { - display_renderRows(0, SCREEN_HEIGHT); + display_renderRows(0, CONFIG_SCREEN_HEIGHT); } bool display_renderingInProgress() diff --git a/platform/drivers/display/SH1106_ttwrplus.c b/platform/drivers/display/SH1106_ttwrplus.c index 07b4c7eb..05fd0098 100644 --- a/platform/drivers/display/SH1106_ttwrplus.c +++ b/platform/drivers/display/SH1106_ttwrplus.c @@ -24,15 +24,15 @@ #include // Display is monochromatic, one bit per pixel -#define FB_SIZE ((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 + 1) +#define FB_SIZE ((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 + 1) static const struct device *displayDev; static const struct display_buffer_descriptor displayBufDesc = { FB_SIZE, - SCREEN_WIDTH, - SCREEN_HEIGHT, - SCREEN_WIDTH, + CONFIG_SCREEN_WIDTH, + CONFIG_SCREEN_HEIGHT, + CONFIG_SCREEN_WIDTH, }; static uint8_t frameBuffer[FB_SIZE]; @@ -64,14 +64,14 @@ void display_render() memset(shadowBuffer, 0x00, FB_SIZE); rendering = true; - for(uint8_t y = 0; y < SCREEN_HEIGHT; y++) + for(uint8_t y = 0; y < CONFIG_SCREEN_HEIGHT; y++) { - for(uint8_t x = 0; x < SCREEN_WIDTH; x++) + for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH; x++) { - size_t cell = x / 8 + y * (SCREEN_WIDTH / 8); + size_t cell = x / 8 + y * (CONFIG_SCREEN_WIDTH / 8); bool pixel = frameBuffer[cell] & (1 << (x % 8)); if (pixel) - shadowBuffer[x + y / 8 * SCREEN_WIDTH] |= 1 << (y % 8); + shadowBuffer[x + y / 8 * CONFIG_SCREEN_WIDTH] |= 1 << (y % 8); } } diff --git a/platform/drivers/display/SH110x_Mod17.c b/platform/drivers/display/SH110x_Mod17.c index 5405b719..e2c24976 100644 --- a/platform/drivers/display/SH110x_Mod17.c +++ b/platform/drivers/display/SH110x_Mod17.c @@ -34,7 +34,7 @@ * starting at 0x20000000. * Pixel format is black and white, one bit per pixel. */ -#define FB_SIZE (((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 ) + 1) +#define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1) static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE]; @@ -109,7 +109,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) for(uint8_t y = startRow; y < endRow; y++) { - for(uint8_t x = 0; x < SCREEN_WIDTH/8; x++) + for(uint8_t x = 0; x < CONFIG_SCREEN_WIDTH/8; x++) { gpio_clearPin(LCD_RS); /* RS low -> command mode */ (void) spi2_sendRecv(y & 0x0F); /* Set Y position */ @@ -117,7 +117,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) (void) spi2_sendRecv(0xB0 | x); /* Set X position */ gpio_setPin(LCD_RS); /* RS high -> data mode */ - size_t pos = x + y * (SCREEN_WIDTH/8); + size_t pos = x + y * (CONFIG_SCREEN_WIDTH/8); spi2_sendRecv(frameBuffer[pos]); } } @@ -127,7 +127,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) void display_render() { - display_renderRows(0, SCREEN_HEIGHT); + display_renderRows(0, CONFIG_SCREEN_HEIGHT); } bool display_renderingInProgress() diff --git a/platform/drivers/display/SSD1306_Mod17.c b/platform/drivers/display/SSD1306_Mod17.c index ea1720b8..daada726 100644 --- a/platform/drivers/display/SSD1306_Mod17.c +++ b/platform/drivers/display/SSD1306_Mod17.c @@ -35,7 +35,7 @@ * starting at 0x20000000. * Pixel format is black and white, one bit per pixel. */ -#define FB_SIZE (((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 ) + 1) +#define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1) static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE]; /** @@ -147,7 +147,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) void display_render() { - display_renderRows(0, (SCREEN_WIDTH / 8) - 1); + display_renderRows(0, (CONFIG_SCREEN_WIDTH / 8) - 1); } bool display_renderingInProgress() diff --git a/platform/drivers/display/ST7567_MD9600.c b/platform/drivers/display/ST7567_MD9600.c index 2d211577..1f63f58f 100644 --- a/platform/drivers/display/ST7567_MD9600.c +++ b/platform/drivers/display/ST7567_MD9600.c @@ -33,7 +33,7 @@ * starting at 0x20000000. * Pixel format is black and white, one bit per pixel. */ -#define FB_SIZE (((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 ) + 1) +#define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1) static uint8_t __attribute__((section(".bss2"))) frameBuffer[FB_SIZE]; /** @@ -132,7 +132,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) void display_render() { - display_renderRows(0, SCREEN_HEIGHT / 8); + display_renderRows(0, CONFIG_SCREEN_HEIGHT / 8); } bool display_renderingInProgress() diff --git a/platform/drivers/display/UC1701_GDx.c b/platform/drivers/display/UC1701_GDx.c index e8fef3e8..e73c4a58 100644 --- a/platform/drivers/display/UC1701_GDx.c +++ b/platform/drivers/display/UC1701_GDx.c @@ -32,7 +32,7 @@ * LCD framebuffer, statically allocated. * Pixel format is black and white, one bit per pixel */ -#define FB_SIZE (((SCREEN_HEIGHT * SCREEN_WIDTH) / 8 ) + 1) +#define FB_SIZE (((CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH) / 8 ) + 1) static uint8_t frameBuffer[FB_SIZE]; /** @@ -157,7 +157,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) void display_render() { - display_renderRows(0, SCREEN_HEIGHT / 8); + display_renderRows(0, CONFIG_SCREEN_HEIGHT / 8); } bool display_renderingInProgress() diff --git a/platform/drivers/display/display_libSDL.c b/platform/drivers/display/display_libSDL.c index 3335c782..397f289a 100644 --- a/platform/drivers/display/display_libSDL.c +++ b/platform/drivers/display/display_libSDL.c @@ -55,14 +55,14 @@ static uint32_t fetchPixelFromFb(unsigned int x, unsigned int y) (void) y; uint32_t pixel = 0; - #ifdef PIX_FMT_BW + #ifdef CONFIG_PIX_FMT_BW /* * Black and white 1bpp format: framebuffer is an array of uint8_t, where * each cell contains the values of eight pixels, one per bit. */ uint8_t *fb = (uint8_t *)(frameBuffer); - unsigned int cell = (x + y*SCREEN_WIDTH) / 8; - unsigned int elem = (x + y*SCREEN_WIDTH) % 8; + unsigned int cell = (x + y*CONFIG_SCREEN_WIDTH) / 8; + unsigned int elem = (x + y*CONFIG_SCREEN_WIDTH) % 8; if(fb[cell] & (1 << elem)) pixel = 0xFFFFFFFF; #endif @@ -72,7 +72,7 @@ static uint32_t fetchPixelFromFb(unsigned int x, unsigned int y) * replicating the pixel value for the three components */ uint8_t *fb = (uint8_t *)(frameBuffer); - uint8_t px = fb[x + y*SCREEN_WIDTH]; + uint8_t px = fb[x + y*CONFIG_SCREEN_WIDTH]; pixel = 0xFF000000 | (px << 16) | (px << 8) | px; #endif @@ -86,12 +86,12 @@ void display_init() /* * Black and white pixel format: framebuffer type is uint8_t where each * bit represents a pixel. We have to allocate - * (SCREEN_HEIGHT * SCREEN_WIDTH)/8 elements + * (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH)/8 elements */ - #ifdef PIX_FMT_BW - unsigned int fbSize = (SCREEN_HEIGHT * SCREEN_WIDTH)/8; + #ifdef CONFIG_PIX_FMT_BW + unsigned int fbSize = (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH)/8; /* Compensate for eventual truncation error in division */ - if((fbSize * 8) < (SCREEN_HEIGHT * SCREEN_WIDTH)) fbSize += 1; + if((fbSize * 8) < (CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH)) fbSize += 1; fbSize *= sizeof(uint8_t); #endif @@ -100,15 +100,15 @@ void display_init() * controls one pixel */ #ifdef PIX_FMT_GRAYSC - unsigned int fbSize = SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(uint8_t); + unsigned int fbSize = CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH * sizeof(uint8_t); #endif /* * RGB565 pixel format: framebuffer type is uint16_t where each element * controls one pixel */ - #ifdef PIX_FMT_RGB565 - unsigned int fbSize = SCREEN_HEIGHT * SCREEN_WIDTH * sizeof(uint16_t); + #ifdef CONFIG_PIX_FMT_RGB565 + unsigned int fbSize = CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH * sizeof(uint16_t); #endif frameBuffer = malloc(fbSize); @@ -140,15 +140,15 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) // receive a texture pixel map void *fb; chan_recv(&fb_sync, &fb); - #ifdef PIX_FMT_RGB565 - memcpy(fb, frameBuffer, sizeof(PIXEL_SIZE) * SCREEN_HEIGHT * SCREEN_WIDTH); + #ifdef CONFIG_PIX_FMT_RGB565 + memcpy(fb, frameBuffer, sizeof(PIXEL_SIZE) * CONFIG_SCREEN_HEIGHT * CONFIG_SCREEN_WIDTH); #else uint32_t *pixels = (uint32_t *) fb; - for (unsigned int x = 0; x < SCREEN_WIDTH; x++) + for (unsigned int x = 0; x < CONFIG_SCREEN_WIDTH; x++) { for (unsigned int y = startRow; y < endRow; y++) { - pixels[x + y * SCREEN_WIDTH] = fetchPixelFromFb(x, y); + pixels[x + y * CONFIG_SCREEN_WIDTH] = fetchPixelFromFb(x, y); } } #endif @@ -162,7 +162,7 @@ void display_renderRows(uint8_t startRow, uint8_t endRow) void display_render() { - display_renderRows(0, SCREEN_HEIGHT); + display_renderRows(0, CONFIG_SCREEN_HEIGHT); } bool display_renderingInProgress() diff --git a/platform/drivers/stubs/display_stub.c b/platform/drivers/stubs/display_stub.c index e35622e3..e612b68e 100644 --- a/platform/drivers/stubs/display_stub.c +++ b/platform/drivers/stubs/display_stub.c @@ -21,10 +21,10 @@ #include #include -#ifdef PIX_FMT_BW -static uint8_t frameBuffer[(((SCREEN_WIDTH * SCREEN_HEIGHT) / 8 ) + 1)]; +#ifdef CONFIG_PIX_FMT_BW +static uint8_t frameBuffer[(((CONFIG_SCREEN_WIDTH * CONFIG_SCREEN_HEIGHT) / 8 ) + 1)]; #else -static uint16_t frameBuffer[SCREEN_WIDTH * SCREEN_HEIGHT]; +static uint16_t frameBuffer[CONFIG_SCREEN_WIDTH * CONFIG_SCREEN_HEIGHT]; #endif diff --git a/platform/targets/DM-1801/hwconfig.h b/platform/targets/DM-1801/hwconfig.h index f684f579..36f8e4f9 100644 --- a/platform/targets/DM-1801/hwconfig.h +++ b/platform/targets/DM-1801/hwconfig.h @@ -29,18 +29,18 @@ extern "C" { #endif /* Screen dimensions */ -#define SCREEN_WIDTH 128 -#define SCREEN_HEIGHT 64 +#define CONFIG_SCREEN_WIDTH 128 +#define CONFIG_SCREEN_HEIGHT 64 /* Screen pixel format */ -#define PIX_FMT_BW +#define CONFIG_PIX_FMT_BW /* Screen has adjustable contrast */ -#define SCREEN_CONTRAST -#define DEFAULT_CONTRAST 71 +#define CONFIG_SCREEN_CONTRAST +#define CONFIG_DEFAULT_CONTRAST 71 /* Screen has adjustable brightness */ -#define SCREEN_BRIGHTNESS +#define CONFIG_SCREEN_BRIGHTNESS /* Battery type */ #define BAT_LIPO_2S diff --git a/platform/targets/GD-77/hwconfig.h b/platform/targets/GD-77/hwconfig.h index f684f579..36f8e4f9 100644 --- a/platform/targets/GD-77/hwconfig.h +++ b/platform/targets/GD-77/hwconfig.h @@ -29,18 +29,18 @@ extern "C" { #endif /* Screen dimensions */ -#define SCREEN_WIDTH 128 -#define SCREEN_HEIGHT 64 +#define CONFIG_SCREEN_WIDTH 128 +#define CONFIG_SCREEN_HEIGHT 64 /* Screen pixel format */ -#define PIX_FMT_BW +#define CONFIG_PIX_FMT_BW /* Screen has adjustable contrast */ -#define SCREEN_CONTRAST -#define DEFAULT_CONTRAST 71 +#define CONFIG_SCREEN_CONTRAST +#define CONFIG_DEFAULT_CONTRAST 71 /* Screen has adjustable brightness */ -#define SCREEN_BRIGHTNESS +#define CONFIG_SCREEN_BRIGHTNESS /* Battery type */ #define BAT_LIPO_2S diff --git a/platform/targets/MD-3x0/hwconfig.h b/platform/targets/MD-3x0/hwconfig.h index 8a601e0f..0bc8f60a 100644 --- a/platform/targets/MD-3x0/hwconfig.h +++ b/platform/targets/MD-3x0/hwconfig.h @@ -37,14 +37,14 @@ extern "C" { #define HAS_ABSOLUTE_KNOB /* Screen dimensions */ -#define SCREEN_WIDTH 160 -#define SCREEN_HEIGHT 128 +#define CONFIG_SCREEN_WIDTH 160 +#define CONFIG_SCREEN_HEIGHT 128 /* Screen pixel format */ -#define PIX_FMT_RGB565 +#define CONFIG_PIX_FMT_RGB565 /* Screen has adjustable brightness */ -#define SCREEN_BRIGHTNESS +#define CONFIG_SCREEN_BRIGHTNESS /* Battery type */ #define BAT_LIPO_2S diff --git a/platform/targets/MD-9600/hwconfig.h b/platform/targets/MD-9600/hwconfig.h index 0d6e3e6f..6b90387c 100644 --- a/platform/targets/MD-9600/hwconfig.h +++ b/platform/targets/MD-9600/hwconfig.h @@ -35,15 +35,15 @@ extern "C" { #define GPS_PRESENT /* Screen dimensions */ -#define SCREEN_WIDTH 128 -#define SCREEN_HEIGHT 64 +#define CONFIG_SCREEN_WIDTH 128 +#define CONFIG_SCREEN_HEIGHT 64 /* Screen has adjustable contrast */ -#define SCREEN_CONTRAST -#define DEFAULT_CONTRAST 91 +#define CONFIG_SCREEN_CONTRAST +#define CONFIG_DEFAULT_CONTRAST 91 /* Screen pixel format */ -#define PIX_FMT_BW +#define CONFIG_PIX_FMT_BW /* Battery type */ #define BAT_NONE diff --git a/platform/targets/MD-UV3x0/hwconfig.h b/platform/targets/MD-UV3x0/hwconfig.h index ab86f065..50de89c3 100644 --- a/platform/targets/MD-UV3x0/hwconfig.h +++ b/platform/targets/MD-UV3x0/hwconfig.h @@ -34,11 +34,11 @@ extern "C" { #define GPS_PRESENT /* Screen dimensions */ -#define SCREEN_WIDTH 160 -#define SCREEN_HEIGHT 128 +#define CONFIG_SCREEN_WIDTH 160 +#define CONFIG_SCREEN_HEIGHT 128 /* Screen pixel format */ -#define PIX_FMT_RGB565 +#define CONFIG_PIX_FMT_RGB565 /* Battery type */ #define BAT_LIPO_2S @@ -62,7 +62,7 @@ extern "C" { * pin and its frequency has to be low (~250Hz) to not put too much overehad on * the processor due to timer ISR triggering at an high rate. * - * #define SCREEN_BRIGHTNESS + * #define CONFIG_SCREEN_BRIGHTNESS */ #ifdef __cplusplus diff --git a/platform/targets/MD-UV3x0/platform.c b/platform/targets/MD-UV3x0/platform.c index 9348e231..b6628536 100644 --- a/platform/targets/MD-UV3x0/platform.c +++ b/platform/targets/MD-UV3x0/platform.c @@ -29,7 +29,7 @@ #include #include -#ifdef SCREEN_BRIGHTNESS +#ifdef CONFIG_SCREEN_BRIGHTNESS #include #endif diff --git a/platform/targets/Module17/hwconfig.h b/platform/targets/Module17/hwconfig.h index ce93b90e..c06890c7 100644 --- a/platform/targets/Module17/hwconfig.h +++ b/platform/targets/Module17/hwconfig.h @@ -26,15 +26,15 @@ #include "pinmap.h" /* Screen dimensions */ -#define SCREEN_WIDTH 128 -#define SCREEN_HEIGHT 64 +#define CONFIG_SCREEN_WIDTH 128 +#define CONFIG_SCREEN_HEIGHT 64 /* Screen has adjustable contrast */ -#define SCREEN_CONTRAST -#define DEFAULT_CONTRAST 91 +#define CONFIG_SCREEN_CONTRAST +#define CONFIG_DEFAULT_CONTRAST 91 /* Screen pixel format */ -#define PIX_FMT_BW +#define CONFIG_PIX_FMT_BW /* Device has no battery */ #define BAT_NONE diff --git a/platform/targets/linux/emulator/emulator.h b/platform/targets/linux/emulator/emulator.h index bdae45d0..e7ac141b 100644 --- a/platform/targets/linux/emulator/emulator.h +++ b/platform/targets/linux/emulator/emulator.h @@ -25,12 +25,12 @@ #include #include -#ifndef SCREEN_WIDTH -#define SCREEN_WIDTH 160 +#ifndef CONFIG_SCREEN_WIDTH +#define CONFIG_SCREEN_WIDTH 160 #endif -#ifndef SCREEN_HEIGHT -#define SCREEN_HEIGHT 128 +#ifndef CONFIG_SCREEN_HEIGHT +#define CONFIG_SCREEN_HEIGHT 128 #endif enum choices diff --git a/platform/targets/linux/emulator/sdl_engine.c b/platform/targets/linux/emulator/sdl_engine.c index 97776589..0c509cd8 100644 --- a/platform/targets/linux/emulator/sdl_engine.c +++ b/platform/targets/linux/emulator/sdl_engine.c @@ -289,16 +289,16 @@ void sdlEngine_init() window = SDL_CreateWindow("OpenRTX", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, - SCREEN_WIDTH * 3, SCREEN_HEIGHT * 3, + CONFIG_SCREEN_WIDTH * 3, CONFIG_SCREEN_HEIGHT * 3, SDL_WINDOW_SHOWN ); renderer = SDL_CreateRenderer(window, -1, 0); - SDL_RenderSetLogicalSize(renderer, SCREEN_WIDTH, SCREEN_HEIGHT); + SDL_RenderSetLogicalSize(renderer, CONFIG_SCREEN_WIDTH, CONFIG_SCREEN_HEIGHT); displayTexture = SDL_CreateTexture(renderer, PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING, - SCREEN_WIDTH, - SCREEN_HEIGHT); + CONFIG_SCREEN_WIDTH, + CONFIG_SCREEN_HEIGHT); SDL_RenderClear(renderer); // Setting brightness also triggers a render diff --git a/platform/targets/linux/emulator/sdl_engine.h b/platform/targets/linux/emulator/sdl_engine.h index 81948469..352bf948 100644 --- a/platform/targets/linux/emulator/sdl_engine.h +++ b/platform/targets/linux/emulator/sdl_engine.h @@ -26,15 +26,15 @@ * Screen dimensions, adjust basing on the size of the screen you need to * emulate */ -#ifndef SCREEN_WIDTH -#define SCREEN_WIDTH 160 +#ifndef CONFIG_SCREEN_WIDTH +#define CONFIG_SCREEN_WIDTH 160 #endif -#ifndef SCREEN_HEIGHT -#define SCREEN_HEIGHT 128 +#ifndef CONFIG_SCREEN_HEIGHT +#define CONFIG_SCREEN_HEIGHT 128 #endif -#ifdef PIX_FMT_RGB565 +#ifdef CONFIG_PIX_FMT_RGB565 #define PIXEL_FORMAT SDL_PIXELFORMAT_RGB565 #define PIXEL_SIZE uint16_t #else diff --git a/platform/targets/linux/hwconfig.h b/platform/targets/linux/hwconfig.h index d6dc2246..a41ed72a 100644 --- a/platform/targets/linux/hwconfig.h +++ b/platform/targets/linux/hwconfig.h @@ -23,7 +23,7 @@ extern "C" { #endif /* Screen has adjustable brightness */ -#define SCREEN_BRIGHTNESS +#define CONFIG_SCREEN_BRIGHTNESS /* Battery type */ #define BAT_LIPO_2S diff --git a/platform/targets/ttwrplus/CMakeLists.txt b/platform/targets/ttwrplus/CMakeLists.txt index 902f91c1..7f8fbf8a 100644 --- a/platform/targets/ttwrplus/CMakeLists.txt +++ b/platform/targets/ttwrplus/CMakeLists.txt @@ -35,4 +35,4 @@ target_include_directories(app ${OPENRTX_ROOT}/subprojects/XPowersLib/src/REG ) -target_compile_definitions(app PRIVATE PLATFORM_TTWRPLUS SCREEN_BRIGHTNESS UI_NO_KEYBOARD) +target_compile_definitions(app PRIVATE PLATFORM_TTWRPLUS CONFIG_SCREEN_BRIGHTNESS UI_NO_KEYBOARD) diff --git a/platform/targets/ttwrplus/hwconfig.h b/platform/targets/ttwrplus/hwconfig.h index 6b115c24..9140cfbc 100644 --- a/platform/targets/ttwrplus/hwconfig.h +++ b/platform/targets/ttwrplus/hwconfig.h @@ -26,9 +26,9 @@ * Display properties are encoded in the devicetree */ #define DISPLAY DT_CHOSEN(zephyr_display) -#define SCREEN_WIDTH DT_PROP(DISPLAY, width) -#define SCREEN_HEIGHT DT_PROP(DISPLAY, height) -#define PIX_FMT_BW +#define CONFIG_SCREEN_WIDTH DT_PROP(DISPLAY, width) +#define CONFIG_SCREEN_HEIGHT DT_PROP(DISPLAY, height) +#define CONFIG_PIX_FMT_BW #define GPS_PRESENT #define BAT_LIPO_1S