feat : disable/enable led on no display board

This commit is contained in:
Julio MATARRANZ 2024-02-27 21:56:53 +01:00
parent 905f3fe81d
commit 895db8c27f
4 changed files with 23 additions and 2 deletions

View File

@ -151,7 +151,8 @@ build_flags =
-D DEVKITV1=1
-D PIN_BUTTON_1=0
-D LED_PIN=22
;-D DEBUG_MINING=1
-D ACTIVE_LED=LOW
-D INACTIVE_LED=HIGH
lib_deps =
https://github.com/takkaO/OpenFontRender
bblanchon/ArduinoJson@^6.21.2

View File

@ -4,6 +4,9 @@
#define PIN_BUTTON_1 0
#define LED_PIN 33
#define ACTIVE_LED HIGH
#define INACTIVE_LED LOW
#define NO_DISPLAY
// example how to configure SD card.

View File

@ -5,6 +5,14 @@
#define PIN_BUTTON_1 0
#endif
#ifndef ACTIVE_LED
#define ACTIVE_LED HIGH
#endif
#ifndef INACTIVE_LED
#define INACTIVE_LED LOW
#endif
#ifndef LED_PIN
#define LED_PIN 2
#endif

View File

@ -7,6 +7,7 @@
#include "wManager.h"
extern monitor_data mMonitor;
bool ledOn = false;
void noDisplay_Init(void)
{
@ -16,6 +17,8 @@ void noDisplay_Init(void)
void noDisplay_AlternateScreenState(void)
{
Serial.println("Switching display state");
ledOn = !ledOn;
}
void noDisplay_AlternateRotation(void)
@ -56,11 +59,17 @@ void noDisplay_DoLedStuff(unsigned long frame)
{
unsigned long currentMillis = millis();
if (!ledOn)
{
digitalWrite(LED_PIN, INACTIVE_LED);
return;
}
switch (mMonitor.NerdStatus)
{
case NM_waitingConfig:
digitalWrite(LED_PIN, HIGH); // LED encendido de forma continua
digitalWrite(LED_PIN, ACTIVE_LED); // LED encendido de forma continua
break;
case NM_Connecting: