fix(v14): OLED brightness wraps above 235 (#7633)
Co-authored-by: Peter Feerick <5500713+pfeerick@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Peter Feerick
Claude Sonnet 5
parent
c8499366a2
commit
b6e52f5ee3
@@ -390,7 +390,9 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
IS_RADIOMASTER_ZORRO(board);
|
||||
|
||||
case MaxContrast:
|
||||
if (IS_TARANIS_SMALL(board))
|
||||
if (getCapability(board, LcdOLED))
|
||||
return 254;
|
||||
else if (IS_TARANIS_SMALL(board))
|
||||
return 30;
|
||||
else
|
||||
return 45;
|
||||
@@ -399,7 +401,9 @@ int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
return 23;
|
||||
|
||||
case MinContrast:
|
||||
if (IS_TARANIS_X9(board))
|
||||
if (getCapability(board, LcdOLED))
|
||||
return 2;
|
||||
else if (IS_TARANIS_X9(board))
|
||||
return 0;
|
||||
else
|
||||
return 10;
|
||||
|
||||
@@ -141,6 +141,15 @@ ui(new Ui::GeneralSetup)
|
||||
ui->contrastSB->setMaximum(Boards::getCapability(board, Board::MaxContrast));
|
||||
ui->contrastSB->setValue(generalSettings.contrast);
|
||||
|
||||
if (Boards::getCapability(board, Board::LcdOLED)) {
|
||||
// OLED radios have no backlight - "contrast" is the panel brightness
|
||||
ui->label_contrast->setText(tr("Brightness"));
|
||||
ui->BLBright_SB->hide();
|
||||
ui->BLBright_SB->setDisabled(true);
|
||||
ui->label_BLBright->hide();
|
||||
ui->blAlarm_LB->setText(tr("Flash display on alarm"));
|
||||
}
|
||||
|
||||
ui->battwarningDSB->setValue((double)generalSettings.vBatWarn / 10);
|
||||
ui->backlightautoSB->setValue(generalSettings.backlightDelay * 5);
|
||||
ui->inactimerSB->setValue(generalSettings.inactivityTimer);
|
||||
|
||||
@@ -327,9 +327,6 @@ Mode 4:
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string extracomment="Screen Contrast [20-45]"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Contrast</string>
|
||||
</property>
|
||||
@@ -659,12 +656,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html></string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
@@ -1740,12 +1732,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html></string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
|
||||
@@ -754,7 +754,7 @@
|
||||
#define BACKLIGHT_CCMR1 TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 // Channel 1, PWM
|
||||
#define BACKLIGHT_CCER TIM_CCER_CC1E
|
||||
#define BACKLIGHT_COUNTER_REGISTER BACKLIGHT_TIMER->CCR1
|
||||
#elif defined(RADIO_T8) || defined(RADIO_TPROV2) || defined(RADIO_TPROS) || defined(RADIO_FAMILY_T20) || defined(RADIO_T14) || defined(RADIO_BUMBLEBEE) || defined(RADIO_GX12)
|
||||
#elif defined(RADIO_T8) || defined(RADIO_TPROV2) || defined(RADIO_TPROS) || defined(RADIO_FAMILY_T20) || defined(RADIO_T14) || defined(RADIO_BUMBLEBEE) || defined(RADIO_GX12) || defined(RADIO_V14)
|
||||
// No backlight: OLED display
|
||||
#elif defined(RADIO_COMMANDO8)
|
||||
#define BACKLIGHT_TIMER_FREQ (PERI1_FREQUENCY * TIMER_MULT_APB1)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#if OLED_SCREEN
|
||||
#define LCD_CONTRAST_OFFSET 0
|
||||
#elif defined(RADIO_FAMILY_JUMPER_T12) || defined(MANUFACTURER_RADIOMASTER) || defined(RADIO_COMMANDO8) || defined(RADIO_TPRO) || defined(RADIO_T12MAX) || defined(RADIO_V14) || defined(RADIO_V14LCD)
|
||||
#elif defined(RADIO_FAMILY_JUMPER_T12) || defined(MANUFACTURER_RADIOMASTER) || defined(RADIO_COMMANDO8) || defined(RADIO_TPRO) || defined(RADIO_T12MAX) || defined(RADIO_V14LCD)
|
||||
#define LCD_CONTRAST_OFFSET -10
|
||||
#else
|
||||
#define LCD_CONTRAST_OFFSET 160
|
||||
@@ -177,7 +177,7 @@ void lcdStart()
|
||||
lcdWriteCommand(0x0A); // Set Vop
|
||||
lcdWriteCommand(0xa6); // Set display mode
|
||||
#else
|
||||
#if defined(RADIO_V14) || defined(RADIO_V14LCD)
|
||||
#if defined(RADIO_V14LCD)
|
||||
lcdWriteCommand(0xe2); // (14) Soft reset
|
||||
lcdWriteCommand(0xa1); // Set seg
|
||||
lcdWriteCommand(0xc0); // Set com
|
||||
@@ -439,7 +439,7 @@ void lcdSetRefVolt(uint8_t val)
|
||||
WAIT_FOR_DMA_END();
|
||||
#endif
|
||||
|
||||
#if defined(RADIO_V14) || defined(RADIO_V14LCD)
|
||||
#if defined(RADIO_V14LCD)
|
||||
lcdWriteCommand(0x81); // Set Vop
|
||||
lcdWriteCommand(val+LCD_CONTRAST_OFFSET+20);// 0-255
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user