diff --git a/platformio.ini b/platformio.ini index 49043f3..83f1d90 100644 --- a/platformio.ini +++ b/platformio.ini @@ -17,6 +17,10 @@ board = uno framework = arduino monitor_filters = time, default monitor_speed = 115200 +build_flags = + -D EVENTUALLY_MAX_COMMANDS=5 + -D EVENTUALLY_COMMAND_BUFFER_LENGTH=14 + -D EVENTUALLY_DATA_BUFFER_LENGTH=10 lib_deps = matthewturner/Eventually2@^2.0 matthewturner/EventuallyCommand@^0.4.0 diff --git a/src/main.cpp b/src/main.cpp index d0c3632..a6d6db3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,13 +4,13 @@ void setup() { Serial.begin(115200); - pinMode(BT_RECEIVE_PIN, INPUT); - pinMode(BT_TRANSMIT_PIN, OUTPUT); - bluetoothSerial.begin(9600); + // pinMode(BT_RECEIVE_PIN, INPUT); + // pinMode(BT_TRANSMIT_PIN, OUTPUT); + // bluetoothSerial.begin(9600); pinMode(WIFI_RECEIVE_PIN, INPUT); pinMode(WIFI_TRANSMIT_PIN, OUTPUT); - wifiSerial.begin(115200); + wifiSerial.begin(9600); pinMode(SHOW_PIN, INPUT_PULLUP); @@ -24,14 +24,14 @@ void setup() stateMachine.whenInterrupted(IDLE, SENDING); - bluetoothCommandListener.when("set", (EvtCommandAction)relaySet); - bluetoothCommandListener.when("set-schedule", (EvtCommandAction)relaySetSchedule); + bluetoothCommandListener.when("request-sync", (EvtCommandAction)relayRequestSync); - wifiCommandListener.when("request-sync", (EvtCommandAction)relayRequestSync); + wifiCommandListener.when("set-schedule", (EvtCommandAction)relaySetSchedule); + wifiCommandListener.when("set", (EvtCommandAction)relaySet); - mgr.addListener(&stateMachine); - mgr.addListener(&bluetoothCommandListener); + // mgr.addListener(&bluetoothCommandListener); mgr.addListener(&wifiCommandListener); + mgr.addListener(&stateMachine); attachInterrupt(digitalPinToInterrupt(SHOW_PIN), onInterrupt, FALLING); @@ -69,9 +69,9 @@ bool relaySet(IEvtListener *, IEvtContext *, long data) { Serial.println(F("Relaying set command...")); - bluetoothSerial.print(F(">set:")); - bluetoothSerial.print(data); - bluetoothSerial.println(F("!")); + // bluetoothSerial.print(F(">set:")); + // bluetoothSerial.print(data); + // bluetoothSerial.println(F("!")); return true; } @@ -80,9 +80,11 @@ bool relaySetSchedule(IEvtListener *, IEvtContext *, long data) { Serial.println(F("Relaying set-schedule command...")); - bluetoothSerial.print(F(">set-schedule:")); - bluetoothSerial.print(data); - bluetoothSerial.println(F("!")); + // bluetoothSerial.print(F(">set-schedule:")); + // bluetoothSerial.print(data); + // bluetoothSerial.println(F("!")); + + return true; } void loop()