Skip to content

Commit

Permalink
UI Color change on settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pr3y committed Jun 16, 2024
1 parent ab453a7 commit 21f430e
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 131 deletions.
68 changes: 34 additions & 34 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs =
default_envs =
m5stack-cplus1_1
m5stack-cplus2
m5stack-cardputer

[common]
build_flags =
-DBRUCE_VERSION='"1.0"'
build_flags =
-DBRUCE_VERSION='"1.0.2"'
-DMAXFILES=256
-DEEPROMSIZE=64
-DLH=8
-DLW=6
lib_deps =
lib_deps =
WireGuard-ESP32
IRremoteESP8266
Time
Expand All @@ -31,7 +31,7 @@ lib_deps =
NTPClient
Timezone
ESP32Time


[env:m5stack-cplus2]
platform = espressif32
Expand All @@ -41,39 +41,39 @@ board_build.partitions = custom_8Mb.csv
board_build.f_flash = 40000000L
board_upload.flash_size = 8MB
board_upload.maximum_size = 8388608
build_flags =
build_flags =
${common.build_flags}
-DCORE_DEBUG_LEVEL=5
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-mfix-esp32-psram-cache-issue
-mfix-esp32-psram-cache-strategy=memw

-DSTICK_C_PLUS2=1

-DROTATION=3

-DHAS_BTN=1
-DSEL_BTN=37
-DUP_BTN=35
-DDW_BTN=39
-DBTN_ALIAS='"M5"'

-DHAS_SCREEN=1
-DWIDTH=240
-DHEIGHT=135
-DBACKLIGHT=27
-DMINBRIGHT=160

-DLED=19
-DLED_ON=HIGH
-DLED_OFF=LOW
-DBAT_PIN=38

-DFP=1
-DFM=2
-DFG=3
-DMAX_MENU_SIZE=5

-DUSER_SETUP_LOADED=1
-DST7789_2_DRIVER=1
-DTFT_RGB_ORDER=1
Expand All @@ -91,24 +91,24 @@ build_flags =
-DSPI_FREQUENCY=20000000
-DSPI_READ_FREQUENCY=20000000
-DSPI_TOUCH_FREQUENCY=2500000

-DSDCARD_SPI_BUS=HSPI
-DSDCARD_CS=14
-DSDCARD_SCK=0
-DSDCARD_MISO=36
-DSDCARD_MOSI=26

-DGROVE_SDA=32
-DGROVE_SCL=33
lib_deps =
lib_deps =
${common.lib_deps}

[env:m5stack-cplus1_1]
platform = espressif32
board = m5stick-c
framework = arduino
board_build.partitions = custom_4Mb.csv
build_flags =
build_flags =
${common.build_flags}
-DCORE_DEBUG_LEVEL=5
-DSTICK_C_PLUS=1
Expand All @@ -118,20 +118,20 @@ build_flags =
-DUP_BTN=0
-DDW_BTN=39
-DBTN_ALIAS='"M5"'

-DWIDTH=240
-DHEIGHT=135
-DMAX_MENU_SIZE=5
-DHAS_SCREEN=1

-DLED=9 ; 10 is the RED led
-DLED_ON=LOW
-DLED_OFF=HIGH

-DFP=1
-DFM=2
-DFG=3

-DUSER_SETUP_LOADED=1
-DST7789_2_DRIVER=1
-DTFT_RGB_ORDER=1
Expand All @@ -149,16 +149,16 @@ build_flags =
-DSPI_FREQUENCY=20000000
-DSPI_READ_FREQUENCY=20000000
-DSPI_TOUCH_FREQUENCY=2500000

-DSDCARD_SPI_BUS=HSPI
-DSDCARD_CS=14
-DSDCARD_SCK=0
-DSDCARD_MISO=36
-DSDCARD_MOSI=26

-DGROVE_SDA=32
-DGROVE_SCL=33
lib_deps =
lib_deps =
https://github.com/tanakamasayuki/I2C_AXP192
${common.lib_deps}

Expand All @@ -168,34 +168,34 @@ [email protected]
board = m5stack-stamps3
framework = arduino
board_build.partitions = custom_8Mb.csv
build_flags =
build_flags =
${common.build_flags}
-DCORE_DEBUG_LEVEL=5
-DCARDPUTER=1

-DROTATION=1

-DHAS_BTN=1
-DBTN_ALIAS='"Ok"'
-DBTN_PIN=0

-DHAS_SCREEN=1
-DWIDTH=240
-DHEIGHT=135
-DBACKLIGHT=38
-DMINBRIGHT=160
-DMAX_MENU_SIZE=5

-DFP=1
-DFM=2
-DFG=3

-DBAT_PIN=10
-DRGB_LED=21
-DLED=44
-DLED_ON=HIGH
-DLED_OFF=LOW

-DUSER_SETUP_LOADED=1
-DST7789_2_DRIVER=1
-DTFT_RGB_ORDER=1
Expand All @@ -213,15 +213,15 @@ build_flags =
-DSPI_FREQUENCY=20000000
-DSPI_READ_FREQUENCY=20000000
-DSPI_TOUCH_FREQUENCY=2500000

-DSDCARD_SPI_BUS=FSPI
-DSDCARD_CS=12
-DSDCARD_SCK=40
-DSDCARD_MISO=39
-DSDCARD_MOSI=14

-DGROVE_SDA=2
-DGROVE_SCL=1
lib_deps =
lib_deps =
${common.lib_deps}
xylopyrographer/LiteLED@^1.2.0
30 changes: 16 additions & 14 deletions src/TV-B-Gone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Distributed under Creative Commons 2.5 -- Attribution & Share Alike
#include "sd_functions.h"
#include "WORLD_IR_CODES.h"

char16_t FGCOLOR;

/*
Last Updated: 30 Mar. 2018
By Anton Grimpelhuber ([email protected])
Expand Down Expand Up @@ -124,13 +126,13 @@ void StartTvBGone() {
if (region) num_codes=num_NAcodes;
else num_codes=num_EUcodes;

bool endingEarly = false; //will be set to true if the user presses the button during code-sending
bool endingEarly = false; //will be set to true if the user presses the button during code-sending

checkSelPress();
for (i=0 ; i<num_codes; i++) {
if (region == NA) powerCode = NApowerCodes[i];
else powerCode = EUpowerCodes[i];

const uint8_t freq = powerCode->timer_val;
const uint8_t numpairs = powerCode->numpairs;
const uint8_t bitcompression = powerCode->bitcompression;
Expand All @@ -151,14 +153,14 @@ void StartTvBGone() {
bitsleft_r=0;
delay_ten_us(20500);

// if user is pushing (holding down) TRIGGER button, stop transmission early
// if user is pushing (holding down) TRIGGER button, stop transmission early
if (checkSelPress()) // Pause TV-B-Gone
{
while (checkSelPress()) yield();
displayRedStripe("Paused", TFT_WHITE, BGCOLOR);

while (!checkSelPress()){ // Se apertar Select denovo, continua
if(checkEscPress()) {
if(checkEscPress()) {
endingEarly= true;
break;
}
Expand All @@ -169,7 +171,7 @@ void StartTvBGone() {
if (endingEarly) break; // Cancela o TV-B-Gone
displayRedStripe("Running, Wait", TFT_WHITE, FGCOLOR);
}

} //end of POWER code for loop


Expand Down Expand Up @@ -229,7 +231,7 @@ void otherIRcodes() {
if(setupSdCard()) {
bool teste=false;
options = {
{"SD Card", [&]() { fs=&SD; }},
{"SD Card", [&]() { fs=&SD; }},
{"LittleFS", [&]() { fs=&LittleFS; }},
};
delay(200);
Expand All @@ -253,7 +255,7 @@ void otherIRcodes() {
Serial.println("Opened database file.");
bool mode_cmd=true;
options = {
{"Choose cmd", [&]() { mode_cmd=true; }},
{"Choose cmd", [&]() { mode_cmd=true; }},
{"Spam all", [&]() { mode_cmd=false; }},
};
delay(200);
Expand Down Expand Up @@ -282,7 +284,7 @@ void otherIRcodes() {
options = { };
bool exit = false;
for(int i=0; i<=total_codes; i++) {
if(codes[i].type=="raw") options.push_back({ codes[i].name.c_str(), [=](){ sendRawCommand(codes[i].frequency, codes[i].data); }});
if(codes[i].type=="raw") options.push_back({ codes[i].name.c_str(), [=](){ sendRawCommand(codes[i].frequency, codes[i].data); }});
if(codes[i].protocol=="NECext") options.push_back({ codes[i].name.c_str(), [=](){ sendNECextCommand(codes[i].address, codes[i].command); }});
if(codes[i].protocol=="NEC") options.push_back({ codes[i].name.c_str(), [=](){ sendNECCommand(codes[i].address, codes[i].command); }});
if(codes[i].protocol=="RC5") options.push_back({ codes[i].name.c_str(), [=](){ sendRC5Command(codes[i].address, codes[i].command); }});
Expand All @@ -299,11 +301,11 @@ void otherIRcodes() {
if(checkEscPress() || exit) break;
delay(200);
}
}
}



else { // SPAM all codes of the file

int codes_sent=0;
int frequency = 0;
String rawData = "";
Expand All @@ -316,10 +318,10 @@ void otherIRcodes() {
line = databaseFile.readStringUntil('\n');
if(line.startsWith("type:")) total_codes++;
}

Serial.printf("\nStarted SPAM all codes with: %d codes", total_codes);
// comes back to first position, beggining of the file
databaseFile.seek(0);
databaseFile.seek(0);
while (databaseFile.available()) {
progressHandler(codes_sent,total_codes);
line = databaseFile.readStringUntil('\n');
Expand Down Expand Up @@ -394,7 +396,7 @@ void otherIRcodes() {
}
}
}

}
databaseFile.close();
Serial.println("closed");
Expand Down
27 changes: 14 additions & 13 deletions src/TV-B-Gone.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Last Updated: 30 Mar. 2018
By Anton Grimpelhuber ([email protected])
-----------------------------------------------------------
Semver (http://semver.org/) VERSION HISTORY (newest on top):
(date format: yyyymmdd; ex: 20161022 is 22 Oct. 2016)
------------------------------------------------------------
- 20180330 - v1.4 - First port to ESP8266 (tested: wemos D1 mini) by Anton Grimpelhuber
- 20161022 - v1.3 - Semver versioning implemented; various code updates, clarifications, & comment additions, and changes to fix incompatibilities so it will now compile with latest versions of gcc compiler; also improved blink indicator routines & added the ability to stop the code-sending sequence once it has begun; by Gabriel Staples (http://www.ElectricRCAircraftGuy.com)
- 20101023 - v1.2 - Latest version posted by Ken Shirriff on his website here (http://www.righto.com/2010/11/improved-arduino-tv-b-gone.html) (direct download link here: http://arcfn.com/files/arduino-tv-b-gone-1.2.zip)
- 20101018 - v1.2 - Universality for EU (European Union) & NA (North America) added by Mitch Altman; sleep mode added by ka1kjz
- 2010____ - v1.2 - code ported to Arduino; by Ken Shirriff
- 20090816 - v1.2 - for ATtiny85v, by Mitch Altman & Limor Fried (https://www.adafruit.com/), w/some code by Kevin Timmerman & Damien Good
-----------------------------------------------------------
Semver (http://semver.org/) VERSION HISTORY (newest on top):
(date format: yyyymmdd; ex: 20161022 is 22 Oct. 2016)
------------------------------------------------------------
- 20180330 - v1.4 - First port to ESP8266 (tested: wemos D1 mini) by Anton Grimpelhuber
- 20161022 - v1.3 - Semver versioning implemented; various code updates, clarifications, & comment additions, and changes to fix incompatibilities so it will now compile with latest versions of gcc compiler; also improved blink indicator routines & added the ability to stop the code-sending sequence once it has begun; by Gabriel Staples (http://www.ElectricRCAircraftGuy.com)
- 20101023 - v1.2 - Latest version posted by Ken Shirriff on his website here (http://www.righto.com/2010/11/improved-arduino-tv-b-gone.html) (direct download link here: http://arcfn.com/files/arduino-tv-b-gone-1.2.zip)
- 20101018 - v1.2 - Universality for EU (European Union) & NA (North America) added by Mitch Altman; sleep mode added by ka1kjz
- 2010____ - v1.2 - code ported to Arduino; by Ken Shirriff
- 20090816 - v1.2 - for ATtiny85v, by Mitch Altman & Limor Fried (https://www.adafruit.com/), w/some code by Kevin Timmerman & Damien Good
TV-B-Gone for Arduino version 1.2, Oct 23 2010
Ported to Arduino by Ken Shirriff
Expand All @@ -22,7 +22,7 @@ and Sleep mode to Ken's Arduino port
-- Mitch Altman 18-Oct-2010
Thanks to ka1kjz for the code for adding Sleep
<http://www.ka1kjz.com/561/adding-sleep-to-tv-b-gone-code/>
The original code is:
TV-B-Gone Firmware version 1.2
for use with ATtiny85v and v1.2 hardware
Expand Down Expand Up @@ -54,6 +54,7 @@ Distributed under Creative Commons 2.5 -- Attribution & Share Alike
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <FS.h>
#include "globals.h"
#include <SD.h>
//void xmitCodeElement(uint16_t ontime, uint16_t offtime, uint8_t PWM_code );
void quickflashLEDx( uint8_t x );
Expand All @@ -69,4 +70,4 @@ void sendNECCommand(String address, String command);
void sendRC5Command(String address, String command);
void sendSamsungCommand(String address, String command);
void sendSonyCommand(String address, String command);
void otherIRcodes();
void otherIRcodes();
Loading

0 comments on commit 21f430e

Please sign in to comment.