summaryrefslogtreecommitdiff
path: root/platformio/relayctl/src/main.cpp
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-05-17 04:06:18 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-05-17 04:06:18 +0300
commitc0111bf4d3dd91f54d27346970e4c6e0a1ce357e (patch)
treebeb15167412bc3ed60e3e11e9076d27ea6f437e5 /platformio/relayctl/src/main.cpp
parent893e21cc83ee1ecf236a005f1bf4893448e9b3ea (diff)
pio: products refactoring
Diffstat (limited to 'platformio/relayctl/src/main.cpp')
-rw-r--r--platformio/relayctl/src/main.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/platformio/relayctl/src/main.cpp b/platformio/relayctl/src/main.cpp
index 3dab38b..13b00b3 100644
--- a/platformio/relayctl/src/main.cpp
+++ b/platformio/relayctl/src/main.cpp
@@ -3,15 +3,15 @@
#include <DNSServer.h>
#include <Ticker.h>
-#include "mqtt.h"
-#include "config.h"
-#include "logging.h"
-#include "http_server.h"
-#include "led.h"
-#include "config.def.h"
-#include "wifi.h"
+#include <homekit/config.h>
+#include <homekit/logging.h>
+#include <homekit/http_server.h>
+#include <homekit/wifi.h>
+#include <homekit/stopwatch.h>
+
#include "relay.h"
-#include "stopwatch.h"
+#include "leds.h"
+#include "mqtt.h"
using namespace homekit;
@@ -60,7 +60,7 @@ static void wifiConnect() {
}
static void wifiHotspot() {
- esp_led.on();
+ mcu_led->on();
auto scanResults = wifi::scan();
@@ -83,10 +83,10 @@ void setup() {
relay::init();
- pinMode(FLASH_BUTTON_PIN, INPUT_PULLUP);
+ pinMode(CONFIG_FLASH_GPIO, INPUT_PULLUP);
for (uint16_t i = 0; i < recovery_boot_detection_ms; i += recovery_boot_delay_ms) {
delay(recovery_boot_delay_ms);
- if (digitalRead(FLASH_BUTTON_PIN) == LOW) {
+ if (digitalRead(CONFIG_FLASH_GPIO) == LOW) {
working_mode = WorkingMode::RECOVERY;
break;
}
@@ -96,7 +96,7 @@ void setup() {
if (config::isDirty(cfg)) {
PRINTLN("config is dirty, erasing...");
config::erase(cfg);
- board_led.blink(10, 50);
+ board_led->blink(10, 50);
}
switch (working_mode) {
@@ -116,13 +116,13 @@ void loop() {
if (working_mode == WorkingMode::NORMAL) {
if (wifi_state == WiFiConnectionState::WAITING) {
PRINT(".");
- esp_led.blink(2, 50);
+ mcu_led->blink(2, 50);
delay(1000);
return;
}
if (wifi_state == WiFiConnectionState::JUST_CONNECTED) {
- board_led.blink(3, 300);
+ board_led->blink(3, 300);
wifi_state = WiFiConnectionState::CONNECTED;
if (service == nullptr)
@@ -147,7 +147,7 @@ void loop() {
#if MQTT_BLINK
// periodically blink board led
if (blinkStopWatch.elapsed(5000)) {
- board_led.blink(1, 10);
+ board_led->blink(1, 10);
blinkStopWatch.save();
}
#endif