Skip to content

Commit

Permalink
Merge pull request #50 from bmorcelli/dev
Browse files Browse the repository at this point in the history
CYD and Lylygo bright fix
  • Loading branch information
bmorcelli authored Jul 21, 2024
2 parents c5f3da4 + 8eba678 commit c18cd20
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"initializer_list": "cpp",
"regex": "cpp",
"list": "cpp",
"unordered_set": "cpp"
"unordered_set": "cpp",
"chrono": "cpp"
}
}
Binary file modified Launcher/Launcher_2.0_C.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_CYD-2-USB.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_CYD-2432S028.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_Cardputer.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_CoreS3.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_T-Display-S3-Touchscreen.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_core2.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_core_16Mb.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_cplus1_1.bin
Binary file not shown.
Binary file modified Launcher/Launcher_2.0_cplus2.bin
Binary file not shown.
8 changes: 4 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ build_flags =
-DXPT2046_CS=33

-DTFT_BRIGHT_CHANNEL=0
-DTFT_BRIGHT_Bits=12
-DTFT_BRIGHT_FREQ=5000
-DTFT_BRIGHT_Bits=8
-DTFT_BRIGHT_FREQ=10000

lib_deps =
${common.lib_deps}
Expand Down Expand Up @@ -651,8 +651,8 @@ build_flags =
-DXPT2046_CS=33

-DTFT_BRIGHT_CHANNEL=0
-DTFT_BRIGHT_Bits=12
-DTFT_BRIGHT_FREQ=5000
-DTFT_BRIGHT_Bits=8
-DTFT_BRIGHT_FREQ=10000
lib_deps =
${common.lib_deps}
https://github.com/PaulStoffregen/XPT2046_Touchscreen
29 changes: 24 additions & 5 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ void setBrightness(int brightval, bool save) {
#elif defined(M5STACK)
M5.Display.setBrightness(brightval);
#elif defined(T_DISPLAY_S3) || defined(CYD)
int dutyCycle = (brightval*255)/100;
int dutyCycle;
if (brightval==100) dutyCycle=255;
else if (brightval==75) dutyCycle=130;
else if (brightval==50) dutyCycle=70;
else if (brightval==25) dutyCycle=20;
else if (brightval==0) dutyCycle=5;
else dutyCycle = ((brightval*255)/100);

log_i("dutyCycle for bright 0-255: %d",dutyCycle);
ledcWrite(TFT_BRIGHT_CHANNEL,dutyCycle); // Channel 0
#endif
Expand Down Expand Up @@ -52,8 +59,14 @@ void getBrightness() {
axp192.ScreenBreath(bright);
#elif defined(M5STACK)
M5.Display.setBrightness(bright);
#elif defined(T_DISPLAY_S3) || defined(CYD)
int dutyCycle = (bright*255)/100;
#elif defined(T_DISPLAY_S3) || defined(CYD)
int dutyCycle;
if (bright==100) dutyCycle=255;
else if (bright==75) dutyCycle=130;
else if (bright==50) dutyCycle=70;
else if (bright==25) dutyCycle=20;
else if (bright==0) dutyCycle=5;
else dutyCycle = ((bright*255)/100);
log_i("dutyCycle for bright 0-255: %d",dutyCycle);
ledcWrite(TFT_BRIGHT_CHANNEL,dutyCycle); // Channel 0
#endif
Expand All @@ -67,8 +80,14 @@ void getBrightness() {
axp192.ScreenBreath(bright);
#elif defined(M5STACK)
M5.Display.setBrightness(bright);
#elif defined(T_DISPLAY_S3) || defined(CYD)
int dutyCycle = (bright*255)/100;
#elif defined(T_DISPLAY_S3) || defined(CYD)
int dutyCycle;
if (bright==100) dutyCycle=255;
else if (bright==75) dutyCycle=130;
else if (bright==50) dutyCycle=70;
else if (bright==25) dutyCycle=20;
else if (bright==0) dutyCycle=5;
else dutyCycle = ((bright*255)/100);
log_i("dutyCycle for bright 0-255: %d",dutyCycle);
ledcWrite(TFT_BRIGHT_CHANNEL,dutyCycle); // Channel 0
#endif
Expand Down

0 comments on commit c18cd20

Please sign in to comment.