Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

enable sticks3 ext power at infrared config

Geo7a3968eda1b8
diff --git a/src/Controllers/InfraredController.cpp b/src/Controllers/InfraredController.cpp
index c3843a39..677f89da 100644
--- a/src/Controllers/InfraredController.cpp
+++ b/src/Controllers/InfraredController.cpp
@@ -1,4 +1,5 @@
#include "InfraredController.h"
+#include <M5Unified.h>
/*
Constructor
@@ -562,6 +563,30 @@ void InfraredController::handleConfig() {
terminalView.println("Current protocol: '" + selectedProtocol + "'");
terminalView.println("You can change it with 'setprotocol'");
+ // Infrared need EXT power on Sticks3
+ #ifdef DEVICE_STICKS3
+ {
+ auto confirm = userInputManager.readYesNo(
+ "Enable power for built-in IR on StickS3?", true
+ );
+ const uint32_t t0 = millis();
+ bool done = false;
+
+ while (millis() - t0 < 1000) { // retry for 1 sec
+ M5.Power.setExtOutput(confirm);
+
+ // Done when current state matches requested state
+ if (M5.Power.getExtOutput() == confirm) {
+ done = true;
+ break;
+ }
+ delay(100);
+ }
+
+ pinMode(state.getInfraredRxPin(), INPUT_PULLUP);
+ }
+ #endif
+
terminalView.println("Infrared configured.\n");
}