Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
refac: remove M5_LED config and use IRLED
Browse files Browse the repository at this point in the history
  • Loading branch information
chr0m1ng committed Jan 18, 2024
1 parent 8fae87a commit 5a95ae2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
29 changes: 10 additions & 19 deletions m5stick-nemo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ String buildver="2.3.4";
#define SD_CLK_PIN 0
#define SD_MISO_PIN 36
#define SD_MOSI_PIN 26
#define M5_LED_PIN 10
#define M5_LED_ON LOW
#define M5_LED_OFF HIGH
#endif

#if defined(STICK_C_PLUS2)
Expand Down Expand Up @@ -73,9 +70,6 @@ String buildver="2.3.4";
#define SD_CLK_PIN 0
#define SD_MISO_PIN 36
#define SD_MOSI_PIN 26
#define M5_LED_PIN 19
#define M5_LED_ON HIGH
#define M5_LED_OFF LOW
#endif

#if defined(STICK_C)
Expand All @@ -100,9 +94,6 @@ String buildver="2.3.4";
#define SD_CLK_PIN 0
#define SD_MISO_PIN 36
#define SD_MOSI_PIN 26
#define M5_LED_PIN 10
#define M5_LED_ON LOW
#define M5_LED_OFF HIGH
#endif

#if defined(CARDPUTER)
Expand Down Expand Up @@ -133,7 +124,7 @@ String buildver="2.3.4";
#endif

// -=-=-=-=-=- LIST OF CURRENTLY DEFINED FEATURES -=-=-=-=-=-
// M5LED - An LED exposed as M5_LED_PIN
// M5LED - An LED exposed as IRLED
// RTC - Real-time clock exposed as M5.Rtc
// AXP - AXP192 Power Management exposed as M5.Axp
// PWRMGMT - StickC+2 Power Management exposed as M5.Power
Expand Down Expand Up @@ -489,7 +480,7 @@ MENU smenu[] = {
{ TXT_SET_CLOCK, 3},
#endif
#if defined(ROTATION)
{ XT_ROTATION, 7},
{ TXT_ROTATION, 7},
#endif
{ TXT_ABOUT, 10},
{ TXT_REBOOT, 98},
Expand Down Expand Up @@ -593,10 +584,10 @@ int rotation = 1;
DISP.setTextSize(SMALL_TEXT);
DISP.fillScreen(BGCOLOR);
DISP.setCursor(0, 8, 1);
DISP.print("Battery: ");
DISP.print(TXT_BATT);
DISP.print(battery);
DISP.println("%");
DISP.println("Press any button to exit");
DISP.println(TXT_EXIT);
}

int get_battery_voltage() {
Expand Down Expand Up @@ -1311,9 +1302,9 @@ void aj_adv(){
pAdvertising->setAdvertisementData(oAdvertisementData);
pAdvertising->start();
#if defined(M5LED)
digitalWrite(M5_LED_PIN, M5_LED_ON); //LED ON on Stick C Plus
digitalWrite(IRLED, LOW); //LED ON on Stick C Plus
delay(10);
digitalWrite(M5_LED_PIN, M5_LED_OFF); //LED OFF on Stick C Plus
digitalWrite(IRLED, HIGH); //LED OFF on Stick C Plus
#endif
}
if (check_next_press()) {
Expand Down Expand Up @@ -1420,9 +1411,9 @@ void wifispam_loop() {
int i = 0;
int len = 0;
#if defined(M5LED)
digitalWrite(M5_LED_PIN, M5_LED_ON); //LED ON on Stick C Plus
digitalWrite(IRLED, LOW); //LED ON on Stick C Plus
delay(1);
digitalWrite(M5_LED_PIN, M5_LED_OFF); //LED OFF on Stick C Plus
digitalWrite(IRLED, HIGH); //LED OFF on Stick C Plus
#endif
currentTime = millis();
if (currentTime - attackTime > 100) {
Expand Down Expand Up @@ -1805,8 +1796,8 @@ void setup() {

// Pin setup
#if defined(M5LED)
pinMode(M5_LED_PIN, OUTPUT);
digitalWrite(M5_LED_PIN, M5_LED_OFF); //LEDOFF
pinMode(IRLED, OUTPUT);
digitalWrite(IRLED, M5_LED_OFF); //LEDOFF
#endif
#if !defined(KB)
pinMode(M5_BUTTON_HOME, INPUT);
Expand Down
4 changes: 2 additions & 2 deletions portal.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ String clear_GET() {
void blinkLed() {
int count = 0;
while (count < 5) {
digitalWrite(M5_LED_PIN, M5_LED_ON);
digitalWrite(IRLED, LOW);
delay(500);
digitalWrite(M5_LED_PIN, M5_LED_OFF);
digitalWrite(IRLED, HIGH);
delay(500);
count = count + 1;
}
Expand Down
4 changes: 2 additions & 2 deletions tvbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ void delay_ten_us(uint16_t us) {

void quickflashLED( void ) {
#if defined(M5LED)
digitalWrite(M5_LED_PIN, M5_LED_ON);
digitalWrite(IRLED, LOW);
delay_ten_us(3000); // 30 ms ON-time delay
digitalWrite(M5_LED_PIN, M5_LED_OFF);
digitalWrite(IRLED, HIGH);
#endif
}

Expand Down

0 comments on commit 5a95ae2

Please sign in to comment.