Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions boards/CYD-2432S028/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,17 @@ void _post_setup_gpio() {
ledcAttach(TFT_BL, TFT_BRIGHT_FREQ, TFT_BRIGHT_Bits);
ledcWrite(TFT_BL, 255);

// Force sync color inversion to prevent bruceConf.json from overriding
// the value set in _setup_gpio(). For CYD variants with TFT_INVERSION_ON,
// the init() sequence sends INVON; we send INVOFF here to ensure normal colors.
// Apply the board-appropriate color inversion default only on first boot,
// when bruceConf.json has no stored value. Once the user changes "Invert
// Color" in Settings the stored value must persist across reboots (#3053).
if (!bruceConfig.colorInvertedSet) {
#ifdef TFT_INVERSION_ON
bruceConfig.colorInverted = 0;
tft.invertDisplay(0);
bruceConfig.colorInverted = 0;
#else
bruceConfig.colorInverted = 1;
tft.invertDisplay(1);
bruceConfig.colorInverted = 1;
#endif
}
tft.invertDisplay(bruceConfig.colorInverted);

bruceConfigPins.gps_bus.rx = (gpio_num_t)GPS_SERIAL_RX;
bruceConfigPins.gps_bus.tx = (gpio_num_t)GPS_SERIAL_TX;
Expand Down
18 changes: 8 additions & 10 deletions boards/nm-cyd-c5/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,15 @@ void _post_setup_gpio() {
bruceConfigPins.rfTx = 8;
bruceConfigPins.rfRx = 9;

// Force disable color inversion for ST7789/ILI9341 on nm-cyd-c5.
// Must be done here because begin_storage() loads bruceConf.json which may
// override the value set in _setup_gpio().
#ifdef ST7789_DRIVER
bruceConfig.colorInverted = 0;
tft.invertDisplay(0);
#endif
#ifdef ILI9341_DRIVER
bruceConfig.colorInverted = 0;
tft.invertDisplay(0);
// Apply the color inversion default for ST7789/ILI9341 only on first boot,
// when bruceConf.json has no stored value. Once the user changes "Invert
// Color" in Settings the stored value must persist across reboots (#3053).
if (!bruceConfig.colorInvertedSet) {
#if defined(ST7789_DRIVER) || defined(ILI9341_DRIVER)
bruceConfig.colorInverted = 0;
#endif
}
tft.invertDisplay(bruceConfig.colorInverted);

// Force set I2C bus pins for nm-cyd-c5.
// brucePins.conf may have stale/wrong i2c_bus values, so override them
Expand Down
1 change: 1 addition & 0 deletions src/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ void BruceConfig::fromFile(bool checkFS) {
}
if (!setting["colorInverted"].isNull()) {
colorInverted = setting["colorInverted"].as<int>();
colorInvertedSet = true;
} else {
count++;
log_e("Fail");
Expand Down
1 change: 1 addition & 0 deletions src/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class BruceConfig : public BruceTheme {
String wdgwarsApiKey = "your 64-char hex key from wdgwars.pl/profile";
int devMode = 0;
int colorInverted = 1;
bool colorInvertedSet = false;
int badUSBBLEKeyboardLayout = 0;
uint16_t badUSBBLEKeyDelay = 10;
bool badUSBBLEShowOutput = true;
Expand Down