Skip to content

Commit

Permalink
Fix set
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturner committed Nov 4, 2023
1 parent d902aff commit cf827d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bool show()

bool requestSync()
{
if (timeSet && scheduleSet)
if (dateTimeSet && scheduleSet)
{
Serial.println(F("Already synchronized, backing off to main sync schedule..."));
requestSyncListener.setInterval(REQUEST_SYNC_SCHEDULE);
Expand All @@ -79,7 +79,7 @@ bool set(EvtListener *, EvtContext *, long data)
{
stateMachine.transition(SHOWING);
}
timeSet = true;
dateTimeSet = true;
return true;
}

Expand Down
16 changes: 9 additions & 7 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include <SoftwareSerial.h>

const short SHOW_TEMPORARILY_DURATION = 3000;
const int REQUEST_SYNC_INITIAL_SCHEDULE = 1000 * 60; // 1 minute
const int REQUEST_SYNC_SCHEDULE = 1000 * 60 * 60 * 24; // 24 hours
const uint32_t REQUEST_SYNC_INITIAL_SCHEDULE = (uint32_t)1000 * 60; // 1 minute
const uint32_t REQUEST_SYNC_SCHEDULE = (uint32_t)1000 * 60 * 60 * 24; // 24 hours

const byte DATA_PIN = 3;
const byte CLOCK_PIN = 13;
Expand All @@ -42,12 +42,9 @@ Timezone *timezone;
CRGB::HTMLColorCode knownColors[4];
Schedule<byte> colorSchedule(0);
Schedule<Flags> displaySchedule(Flags::NONE, 1);
SoftwareSerial bluetoothSerial(RECEIVE_PIN, TRANSMIT_PIN);
EvtCommandListener commandListener(&bluetoothSerial, 20);
EvtTimeListener requestSyncListener(REQUEST_SYNC_INITIAL_SCHEDULE, true, (EvtAction)requestSync);
EvtStateMachineListener stateMachine;

bool showAfterSet = false;
bool timeSet = false;
bool dateTimeSet = false;
bool scheduleSet = false;

bool showAfterSet = false;
Expand Down Expand Up @@ -75,4 +72,9 @@ void setupRealtimeClock();
void setupTimezones();
void setupTest();

EvtTimeListener requestSyncListener(REQUEST_SYNC_INITIAL_SCHEDULE, true, (EvtAction)requestSync);
SoftwareSerial bluetoothSerial(RECEIVE_PIN, TRANSMIT_PIN);
EvtCommandListener commandListener(&bluetoothSerial, 20);
EvtStateMachineListener stateMachine;

#endif

0 comments on commit cf827d5

Please sign in to comment.