Skip to content

Commit

Permalink
Add set options command
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturner committed Oct 20, 2023
1 parent 0ebcdee commit 4e5f955
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void setup()
commandListener.when("set-schedule", (EvtCommandAction)setSchedule);
commandListener.when("show", (EvtCommandAction)show);
commandListener.when("status", (EvtCommandAction)status);
commandListener.when("set-opt", (EvtCommandAction)setOptions);
mgr.addListener(&commandListener);

stateMachine.when(IDLE, (EvtAction)idle, UPDATING);
Expand Down Expand Up @@ -80,6 +81,14 @@ bool status()
return true;
}

bool setOptions(EvtListener *, EvtContext *, long data)
{
Serial.print(F("Command: SET-OPT "));
Serial.println(data);
showAfterSet = data % 10;
return true;
}

bool updating()
{
Serial.println(F("Updating..."));
Expand Down
2 changes: 2 additions & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Schedule<Flags> displaySchedule(Flags::NONE, 1);
SoftwareSerial bluetoothSerial(RECEIVE_PIN, TRANSMIT_PIN);
EvtCommandListener commandListener(&bluetoothSerial, 20);
EvtStateMachineListener stateMachine;
bool showAfterSet = false;

void onInterrupt();
void render();
Expand All @@ -53,6 +54,7 @@ bool showing();
bool show();
bool set(EvtListener *, EvtContext *, long data);
bool setSchedule(EvtListener *, EvtContext *, long data);
bool setOptions(EvtListener *, EvtContext *, long data);
bool status();
byte brightnessFrom(Flags mode);
CRGB::HTMLColorCode colorFor(byte hour);
Expand Down

0 comments on commit 4e5f955

Please sign in to comment.