kopia lustrzana https://github.com/OpenRTX/OpenRTX
Made Brightness setting optional based on HW capabilities
rodzic
4a6d0b4c2b
commit
c1a9db22b7
|
@ -169,7 +169,6 @@ mdx_src = ['openrtx/src/core/xmodem.c',
|
||||||
'platform/drivers/audio/inputStream_MDx.cpp',
|
'platform/drivers/audio/inputStream_MDx.cpp',
|
||||||
'platform/drivers/audio/outputStream_MDx.cpp',
|
'platform/drivers/audio/outputStream_MDx.cpp',
|
||||||
'platform/drivers/baseband/HR_Cx000.cpp',
|
'platform/drivers/baseband/HR_Cx000.cpp',
|
||||||
'platform/drivers/backlight/backlight_MDx.c',
|
|
||||||
'platform/drivers/tones/toneGenerator_MDx.cpp']
|
'platform/drivers/tones/toneGenerator_MDx.cpp']
|
||||||
|
|
||||||
mdx_src = mdx_src + openrtx_ui_default
|
mdx_src = mdx_src + openrtx_ui_default
|
||||||
|
@ -321,6 +320,7 @@ md3x0_src = src + mdx_src + stm32f405_src + ['platform/drivers/NVM/nvmem_MD3x0.c
|
||||||
'platform/drivers/baseband/HR_C5000_MDx.cpp',
|
'platform/drivers/baseband/HR_C5000_MDx.cpp',
|
||||||
'platform/drivers/keyboard/keyboard_MD3x.c',
|
'platform/drivers/keyboard/keyboard_MD3x.c',
|
||||||
'platform/drivers/display/HX8353_MD3x.cpp',
|
'platform/drivers/display/HX8353_MD3x.cpp',
|
||||||
|
'platform/drivers/backlight/backlight_MDx.c',
|
||||||
'platform/targets/MD-3x0/platform.c']
|
'platform/targets/MD-3x0/platform.c']
|
||||||
|
|
||||||
md3x0_inc = inc + stm32f405_inc + ['platform/targets/MD-3x0']
|
md3x0_inc = inc + stm32f405_inc + ['platform/targets/MD-3x0']
|
||||||
|
@ -335,6 +335,7 @@ mduv3x0_src = src + mdx_src + stm32f405_src + ['platform/drivers/NVM/nvmem_MDUV3
|
||||||
'platform/targets/MD-UV3x0/platform.c',
|
'platform/targets/MD-UV3x0/platform.c',
|
||||||
'platform/drivers/keyboard/keyboard_MD3x.c',
|
'platform/drivers/keyboard/keyboard_MD3x.c',
|
||||||
'platform/drivers/display/HX8353_MD3x.cpp',
|
'platform/drivers/display/HX8353_MD3x.cpp',
|
||||||
|
'platform/drivers/backlight/backlight_MDx.c',
|
||||||
'platform/drivers/chSelector/chSelector_UV3x0.c',
|
'platform/drivers/chSelector/chSelector_UV3x0.c',
|
||||||
'platform/drivers/baseband/radio_UV3x0.cpp',
|
'platform/drivers/baseband/radio_UV3x0.cpp',
|
||||||
'platform/drivers/baseband/AT1846S_UV3x0.cpp',
|
'platform/drivers/baseband/AT1846S_UV3x0.cpp',
|
||||||
|
|
|
@ -109,7 +109,9 @@ enum backupRestoreItems
|
||||||
|
|
||||||
enum displayItems
|
enum displayItems
|
||||||
{
|
{
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
D_BRIGHTNESS = 0,
|
D_BRIGHTNESS = 0,
|
||||||
|
#endif
|
||||||
#ifdef SCREEN_CONTRAST
|
#ifdef SCREEN_CONTRAST
|
||||||
D_CONTRAST,
|
D_CONTRAST,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,14 +73,15 @@ void state_init()
|
||||||
state.emergency = false;
|
state.emergency = false;
|
||||||
|
|
||||||
// Force brightness field to be in range 0 - 100
|
// Force brightness field to be in range 0 - 100
|
||||||
if(state.settings.brightness > 100) state.settings.brightness = 100;
|
if(state.settings.brightness > 100)
|
||||||
|
{
|
||||||
|
state.settings.brightness = 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_terminate()
|
void state_terminate()
|
||||||
{
|
{
|
||||||
/*
|
// Never store a brightness of 0 to avoid booting with a black screen
|
||||||
* Never store a brightness of 0 to avoid booting with a black screen
|
|
||||||
*/
|
|
||||||
if(state.settings.brightness == 0)
|
if(state.settings.brightness == 0)
|
||||||
{
|
{
|
||||||
state.settings.brightness = 5;
|
state.settings.brightness = 5;
|
||||||
|
|
|
@ -147,7 +147,9 @@ const char *settings_items[] =
|
||||||
|
|
||||||
const char *display_items[] =
|
const char *display_items[] =
|
||||||
{
|
{
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
"Brightness",
|
"Brightness",
|
||||||
|
#endif
|
||||||
#ifdef SCREEN_CONTRAST
|
#ifdef SCREEN_CONTRAST
|
||||||
"Contrast",
|
"Contrast",
|
||||||
#endif
|
#endif
|
||||||
|
@ -715,6 +717,7 @@ static void _ui_fsm_insertVFONumber(kbd_msg_t msg, bool *sync_rtx)
|
||||||
vp_play();
|
vp_play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
static void _ui_changeBrightness(int variation)
|
static void _ui_changeBrightness(int variation)
|
||||||
{
|
{
|
||||||
state.settings.brightness += variation;
|
state.settings.brightness += variation;
|
||||||
|
@ -726,6 +729,7 @@ static void _ui_changeBrightness(int variation)
|
||||||
|
|
||||||
display_setBacklightLevel(state.settings.brightness);
|
display_setBacklightLevel(state.settings.brightness);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SCREEN_CONTRAST
|
#ifdef SCREEN_CONTRAST
|
||||||
static void _ui_changeContrast(int variation)
|
static void _ui_changeContrast(int variation)
|
||||||
|
@ -848,6 +852,7 @@ static bool _ui_exitStandby(long long now)
|
||||||
standby = false;
|
standby = false;
|
||||||
redraw_needed = true;
|
redraw_needed = true;
|
||||||
display_setBacklightLevel(state.settings.brightness);
|
display_setBacklightLevel(state.settings.brightness);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -948,7 +953,7 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
|
||||||
float power = dBmToWatt(state.channel.power);
|
float power = dBmToWatt(state.channel.power);
|
||||||
vp_anouncePower(power, queueFlags);
|
vp_anouncePower(power, queueFlags);
|
||||||
break;
|
break;
|
||||||
break;
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
case 7:
|
case 7:
|
||||||
_ui_changeBrightness(-5);
|
_ui_changeBrightness(-5);
|
||||||
vp_announceSettingsInt(¤tLanguage->brightness, queueFlags,
|
vp_announceSettingsInt(¤tLanguage->brightness, queueFlags,
|
||||||
|
@ -959,6 +964,7 @@ static void _ui_fsm_menuMacro(kbd_msg_t msg, bool *sync_rtx)
|
||||||
vp_announceSettingsInt(¤tLanguage->brightness, queueFlags,
|
vp_announceSettingsInt(¤tLanguage->brightness, queueFlags,
|
||||||
state.settings.brightness);
|
state.settings.brightness);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_ABSOLUTE_KNOB // If the radio has an absolute position knob
|
#ifdef HAS_ABSOLUTE_KNOB // If the radio has an absolute position knob
|
||||||
|
@ -1837,11 +1843,13 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
{
|
{
|
||||||
switch(ui_state.menu_selected)
|
switch(ui_state.menu_selected)
|
||||||
{
|
{
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
case D_BRIGHTNESS:
|
case D_BRIGHTNESS:
|
||||||
_ui_changeBrightness(-5);
|
_ui_changeBrightness(-5);
|
||||||
vp_announceSettingsInt(¤tLanguage->brightness, queueFlags,
|
vp_announceSettingsInt(¤tLanguage->brightness, queueFlags,
|
||||||
state.settings.brightness);
|
state.settings.brightness);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#ifdef SCREEN_CONTRAST
|
#ifdef SCREEN_CONTRAST
|
||||||
case D_CONTRAST:
|
case D_CONTRAST:
|
||||||
_ui_changeContrast(-4);
|
_ui_changeContrast(-4);
|
||||||
|
@ -1862,11 +1870,13 @@ void ui_updateFSM(bool *sync_rtx)
|
||||||
{
|
{
|
||||||
switch(ui_state.menu_selected)
|
switch(ui_state.menu_selected)
|
||||||
{
|
{
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
case D_BRIGHTNESS:
|
case D_BRIGHTNESS:
|
||||||
_ui_changeBrightness(+5);
|
_ui_changeBrightness(+5);
|
||||||
vp_announceSettingsInt(¤tLanguage->brightness, queueFlags,
|
vp_announceSettingsInt(¤tLanguage->brightness, queueFlags,
|
||||||
state.settings.brightness);
|
state.settings.brightness);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#ifdef SCREEN_CONTRAST
|
#ifdef SCREEN_CONTRAST
|
||||||
case D_CONTRAST:
|
case D_CONTRAST:
|
||||||
_ui_changeContrast(+4);
|
_ui_changeContrast(+4);
|
||||||
|
|
|
@ -265,9 +265,11 @@ int _ui_getDisplayValueName(char *buf, uint8_t max_len, uint8_t index)
|
||||||
uint8_t value = 0;
|
uint8_t value = 0;
|
||||||
switch(index)
|
switch(index)
|
||||||
{
|
{
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
case D_BRIGHTNESS:
|
case D_BRIGHTNESS:
|
||||||
value = last_state.settings.brightness;
|
value = last_state.settings.brightness;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#ifdef SCREEN_CONTRAST
|
#ifdef SCREEN_CONTRAST
|
||||||
case D_CONTRAST:
|
case D_CONTRAST:
|
||||||
value = last_state.settings.contrast;
|
value = last_state.settings.contrast;
|
||||||
|
@ -977,15 +979,19 @@ bool _ui_drawMacroMenu()
|
||||||
// Third row
|
// Third row
|
||||||
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
yellow_fab413, "7");
|
yellow_fab413, "7");
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white, " B-");
|
color_white, " B-");
|
||||||
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_LEFT,
|
||||||
color_white, " %5d",
|
color_white, " %5d",
|
||||||
state.settings.brightness);
|
state.settings.brightness);
|
||||||
|
#endif
|
||||||
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
yellow_fab413, "8");
|
yellow_fab413, "8");
|
||||||
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_CENTER,
|
||||||
color_white, " B+");
|
color_white, " B+");
|
||||||
|
#endif
|
||||||
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
yellow_fab413, "9 ");
|
yellow_fab413, "9 ");
|
||||||
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
gfx_print(layout.line3_pos, layout.top_font, TEXT_ALIGN_RIGHT,
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <hwconfig.h>
|
#include <hwconfig.h>
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
|
|
||||||
#if defined(PLATFORM_MDUV3x0) && defined(ENABLE_BKLIGHT_DIMMING)
|
#if defined(PLATFORM_MDUV3x0) && defined(SCREEN_BRIGHTNESS)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interrupt-based software PWM for backlight dimming on MD-UV3x0.
|
* Interrupt-based software PWM for backlight dimming on MD-UV3x0.
|
||||||
|
@ -83,7 +83,7 @@ void backlight_init()
|
||||||
gpio_setMode(LCD_BKLIGHT, OUTPUT);
|
gpio_setMode(LCD_BKLIGHT, OUTPUT);
|
||||||
gpio_clearPin(LCD_BKLIGHT);
|
gpio_clearPin(LCD_BKLIGHT);
|
||||||
|
|
||||||
#ifdef ENABLE_BKLIGHT_DIMMING
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
/*
|
/*
|
||||||
* Configure TIM11 for backlight PWM: Fpwm = 256Hz, 8 bit of resolution.
|
* Configure TIM11 for backlight PWM: Fpwm = 256Hz, 8 bit of resolution.
|
||||||
* APB2 freq. is 84MHz but timer runs at twice this frequency, then:
|
* 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)
|
if(pwmLevel > 1)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_BKLIGHT_DIMMING
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
TIM11->CCR1 = pwmLevel;
|
TIM11->CCR1 = pwmLevel;
|
||||||
TIM11->CR1 |= TIM_CR1_CEN;
|
TIM11->CR1 |= TIM_CR1_CEN;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -38,6 +38,9 @@ extern "C" {
|
||||||
#define SCREEN_CONTRAST
|
#define SCREEN_CONTRAST
|
||||||
#define DEFAULT_CONTRAST 71
|
#define DEFAULT_CONTRAST 71
|
||||||
|
|
||||||
|
/* Screen has adjustable brightness */
|
||||||
|
#define SCREEN_BRIGHTNESS
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define BAT_LIPO_2S
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ extern "C" {
|
||||||
#define SCREEN_CONTRAST
|
#define SCREEN_CONTRAST
|
||||||
#define DEFAULT_CONTRAST 71
|
#define DEFAULT_CONTRAST 71
|
||||||
|
|
||||||
|
/* Screen has adjustable brightness */
|
||||||
|
#define SCREEN_BRIGHTNESS
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define BAT_LIPO_2S
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,9 @@ extern "C" {
|
||||||
/* Screen pixel format */
|
/* Screen pixel format */
|
||||||
#define PIX_FMT_RGB565
|
#define PIX_FMT_RGB565
|
||||||
|
|
||||||
|
/* Screen has adjustable brightness */
|
||||||
|
#define SCREEN_BRIGHTNESS
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define BAT_LIPO_2S
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <interfaces/delays.h>
|
#include <interfaces/delays.h>
|
||||||
#include <hwconfig.h>
|
#include <hwconfig.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <backlight.h>
|
|
||||||
#include <ADC1_MDx.h>
|
#include <ADC1_MDx.h>
|
||||||
#include <calibInfo_MDx.h>
|
#include <calibInfo_MDx.h>
|
||||||
#include <toneGenerator_MDx.h>
|
#include <toneGenerator_MDx.h>
|
||||||
|
@ -34,7 +33,7 @@
|
||||||
#include <chSelector.h>
|
#include <chSelector.h>
|
||||||
|
|
||||||
/* TODO: Hardcoded hwInfo until we implement reading from flash */
|
/* TODO: Hardcoded hwInfo until we implement reading from flash */
|
||||||
static const hwInfo_t hwInfo
|
static const hwInfo_t hwInfo =
|
||||||
{
|
{
|
||||||
.vhf_maxFreq = 174,
|
.vhf_maxFreq = 174,
|
||||||
.vhf_minFreq = 136,
|
.vhf_minFreq = 136,
|
||||||
|
@ -44,7 +43,7 @@ static const hwInfo_t hwInfo
|
||||||
.uhf_band = 1,
|
.uhf_band = 1,
|
||||||
.hw_version = 0,
|
.hw_version = 0,
|
||||||
.name = "MD-9600"
|
.name = "MD-9600"
|
||||||
}
|
};
|
||||||
|
|
||||||
void platform_init()
|
void platform_init()
|
||||||
{
|
{
|
||||||
|
@ -76,16 +75,12 @@ void platform_init()
|
||||||
nvm_init(); /* Initialise non volatile memory manager */
|
nvm_init(); /* Initialise non volatile memory manager */
|
||||||
toneGen_init(); /* Initialise tone generator */
|
toneGen_init(); /* Initialise tone generator */
|
||||||
rtc_init(); /* Initialise RTC */
|
rtc_init(); /* Initialise RTC */
|
||||||
backlight_init(); /* Initialise backlight driver */
|
|
||||||
chSelector_init(); /* Initialise channel selector handler */
|
chSelector_init(); /* Initialise channel selector handler */
|
||||||
audio_init(); /* Initialise audio management module */
|
audio_init(); /* Initialise audio management module */
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_terminate()
|
void platform_terminate()
|
||||||
{
|
{
|
||||||
/* Shut down backlight */
|
|
||||||
backlight_terminate();
|
|
||||||
|
|
||||||
/* Shut down all the modules */
|
/* Shut down all the modules */
|
||||||
adc1_terminate();
|
adc1_terminate();
|
||||||
toneGen_terminate();
|
toneGen_terminate();
|
||||||
|
|
|
@ -151,7 +151,7 @@ extern "C" {
|
||||||
* pin and its frequency has to be low (~250Hz) to not put too much overehad on
|
* 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.
|
* the processor due to timer ISR triggering at an high rate.
|
||||||
*
|
*
|
||||||
* #define ENABLE_BKLIGHT_DIMMING
|
* #define SCREEN_BRIGHTNESS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <interfaces/audio.h>
|
#include <interfaces/audio.h>
|
||||||
#include <chSelector.h>
|
#include <chSelector.h>
|
||||||
|
|
||||||
#ifdef ENABLE_BKLIGHT_DIMMING
|
#ifdef SCREEN_BRIGHTNESS
|
||||||
#include <backlight.h>
|
#include <backlight.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,9 @@ extern "C" {
|
||||||
/* Device supports an optional GPS chip */
|
/* Device supports an optional GPS chip */
|
||||||
#define GPS_PRESENT
|
#define GPS_PRESENT
|
||||||
|
|
||||||
|
/* Screen has adjustable brightness */
|
||||||
|
#define SCREEN_BRIGHTNESS
|
||||||
|
|
||||||
/* Battery type */
|
/* Battery type */
|
||||||
#define BAT_LIPO_2S
|
#define BAT_LIPO_2S
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue