Skip to content

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

improve infrared receive to be able to receive and decode more cmd per sec

Geo59af9ca85bc3
diff --git a/src/Controllers/InfraredController.cpp b/src/Controllers/InfraredController.cpp
index 0010f31c..9ada53e1 100644
--- a/src/Controllers/InfraredController.cpp
+++ b/src/Controllers/InfraredController.cpp
@@ -74,7 +74,8 @@ Receive
void InfraredController::handleReceive() {
terminalView.println("Receiving infrared signal...");
terminalView.println("Press ENTER to cancel.\n");
-
+
+ infraredService.startReceiver();
while (true) {
// Check Enter press
char c = terminalInput.readChar();
@@ -96,6 +97,7 @@ void InfraredController::handleReceive() {
terminalView.println("INFRARED Receive: Waiting for next signal or press ENTER to exit.");
}
}
+ infraredService.stopReceiver();
}
/*
diff --git a/src/Services/InfraredService.cpp b/src/Services/InfraredService.cpp
index 6b603ab3..941f6ee7 100644
--- a/src/Services/InfraredService.cpp
+++ b/src/Services/InfraredService.cpp
@@ -6,6 +6,14 @@ void InfraredService::configure(uint8_t tx, uint8_t rx) {
IrReceiver.begin(rx, ENABLE_LED_FEEDBACK);
}
+void InfraredService::startReceiver() {
+ IrReceiver.start();
+}
+
+void InfraredService::stopReceiver() {
+ IrReceiver.stop();
+}
+
void InfraredService::sendInfraredCommand(InfraredCommand command) {
uint8_t subdevice;
uint16_t address;
@@ -55,7 +63,6 @@ void InfraredService::sendInfraredCommand(InfraredCommand command) {
}
InfraredCommand InfraredService::receiveInfraredCommand() {
- IrReceiver.start();
InfraredCommand command;
if (!IrReceiver.decode()) {
@@ -149,7 +156,6 @@ InfraredCommand InfraredService::receiveInfraredCommand() {
// Commande principale
command.setFunction(data.command);
- IrReceiver.stop();
return command;
}
diff --git a/src/Services/InfraredService.h b/src/Services/InfraredService.h
index 85d395c0..8da0cd7b 100644
--- a/src/Services/InfraredService.h
+++ b/src/Services/InfraredService.h
@@ -9,6 +9,8 @@
class InfraredService {
public:
void configure(uint8_t tx, uint8_t rx);
+ void startReceiver();
+ void stopReceiver();
void sendInfraredCommand(InfraredCommand command);
InfraredCommand receiveInfraredCommand();
private: