Skip to content

Commit

Permalink
init led at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
rennancockles committed Jan 7, 2025
1 parent 040dd43 commit 8225e6e
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ keyStroke KeyStroke;

TaskHandle_t xHandle;
void __attribute__((weak)) taskInputHandler(void *parameter) {
while (true) {
while (true) {
checkPowerSaveTime();
NextPress=false;
PrevPress=false;
Expand Down Expand Up @@ -88,7 +88,7 @@ uint8_t buff[1024] = {0};
TFT_eSprite sprite = TFT_eSprite(&tft);
TFT_eSprite draw = TFT_eSprite(&tft);
volatile int tftWidth = TFT_HEIGHT;
#ifdef HAS_TOUCH
#ifdef HAS_TOUCH
volatile int tftHeight = TFT_WIDTH-20; // 20px to draw the TouchFooter(), were the btns are being read in touch devices.
#else
volatile int tftHeight = TFT_WIDTH;
Expand All @@ -109,6 +109,7 @@ uint8_t buff[1024] = {0};
#include "core/settings.h"
#include "core/serialcmds.h"
#include "core/wifi_common.h"
#include "modules/others/led_control.h"
#include "modules/others/audio.h" // for playAudioFile
#include "modules/rf/rf.h" // for initCC1101once
#include "modules/bjs_interpreter/interpreter.h" // for JavaScript interpreter
Expand Down Expand Up @@ -167,7 +168,7 @@ void begin_tft(){
tft.setRotation(bruceConfig.rotation); //sometimes it misses the first command
tft.setRotation(bruceConfig.rotation);
tftWidth = tft.width();
#ifdef HAS_TOUCH
#ifdef HAS_TOUCH
tftHeight = tft.height() - 20;
#else
tftHeight = tft.height();
Expand Down Expand Up @@ -221,7 +222,7 @@ void boot_screen_anim() {
}
drawn=true;
}
#if !defined(LITE_VERSION)
#if !defined(LITE_VERSION)
if(!boot_img && (millis()-i>2200) && (millis()-i)<2700) tft.drawRect(2*tftWidth/3,tftHeight/2,2,2,bruceConfig.priColor);
if(!boot_img && (millis()-i>2700) && (millis()-i)<2900) tft.fillRect(0,45,tftWidth,tftHeight-45,bruceConfig.bgColor);
if(!boot_img && (millis()-i>2900) && (millis()-i)<3400) tft.drawXBitmap(2*tftWidth/3 - 30 ,5+tftHeight/2,bruce_small_bits, bruce_small_width, bruce_small_height,bruceConfig.bgColor,bruceConfig.priColor);
Expand Down Expand Up @@ -258,6 +259,17 @@ void init_clock() {
}


/*********************************************************************
** Function: init_led
** Led initialisation
*********************************************************************/
void init_led() {
#ifdef HAS_RGB_LED
beginLed();
#endif
}


/*********************************************************************
** Function: startup_sound
** Play sound or tone depending on device hardware
Expand Down Expand Up @@ -318,11 +330,12 @@ void setup() {
bruceConfig.fromFile();
begin_tft();
init_clock();
init_led();

// Some GPIO Settings (such as CYD's brightness control must be set after tft and sdcard)
_post_setup_gpio();
// end of post gpio begin

// This task keeps running all the time, will never stop
xTaskCreate(
taskInputHandler, // Task function
Expand All @@ -331,7 +344,7 @@ void setup() {
NULL, // Task parameters
2, // Task priority (0 to 3), loopTask has priority 2.
&xHandle // Task handle (not used)
);
);
boot_screen_anim();

startup_sound();
Expand Down

0 comments on commit 8225e6e

Please sign in to comment.