Skip to content

Commit 388c6e9

Browse files
committed
Updating a couple unsigned long literals and comparisons for timings.
1 parent 786a9fb commit 388c6e9

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

Devlpr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ void Devlpr::tick()
2020
// accrue micros on the micros since last run
2121
microsSinceEMG += microsDelta;
2222
// check if enough time has passed to read EMG
23-
if (microsSinceEMG > MICROS_SCHED_EMG) {
23+
if (microsSinceEMG >= MICROS_SCHED_EMG) {
2424
readEMG();
2525
// and update micros since
26-
microsSinceEMG = 0;
26+
microsSinceEMG = 0L;
2727
// NOTE just a best effort to run on time
2828
}
2929
////////////////////////////
@@ -34,11 +34,11 @@ void Devlpr::tick()
3434
// accrue micros on the micros since last run
3535
microsSince[i] += microsDelta;
3636
// check if enough time has passed to run it
37-
if (microsSince[i] > schedMicros[i]) {
37+
if (microsSince[i] >= schedMicros[i]) {
3838
// run it
3939
funcs[i](this);
4040
// and update micros since
41-
microsSince[i] = 0;
41+
microsSince[i] = 0L;
4242
// NOTE just a best effort to run on time
4343
}
4444
}

Devlpr.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class Devlpr
2525
unsigned int emgRunningSum; // if BUFSIZE is small, uint is fine
2626
void readEMG();
2727
// scheduling
28-
unsigned long lastTickMicros = 0;
28+
unsigned long lastTickMicros = 0L;
2929
// emg scheduling
30-
static const unsigned long MICROS_SCHED_EMG = 1000;
31-
unsigned long microsSinceEMG = 0;
30+
static const unsigned long MICROS_SCHED_EMG = 1000L;
31+
unsigned long microsSinceEMG = 0L;
3232
// user function scheduling
3333
static const byte FUNCMAX = 8;
3434
void (*funcs[FUNCMAX])(Devlpr *d);

0 commit comments

Comments
 (0)