Commit 8b316b1a authored by Eric Duminil's avatar Eric Duminil
Browse files

Fixing buggy millis use

parent fe8c9332
......@@ -146,8 +146,7 @@ namespace led_effects {
static uint16_t wheel_offset = 0;
unsigned long t0 = millis();
pixels.setBrightness(config::max_brightness);
//FIXME: OVERFLOW!
while (millis() < t0 + duration_ms) {
while (millis() - t0 < duration_ms) {
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.ColorHSV(i * 65535 / NUMPIXELS + wheel_offset));
wheel_offset += hue_increment;
......
......@@ -184,8 +184,7 @@ namespace lorawan {
void preparePayloadIfTimeHasCome(const int16_t &co2, const float &temperature, const float &humidity) {
static unsigned long last_sent_at = 0;
unsigned long now = seconds();
//FIXME: OVERFLOW!
if (connected && (now > last_sent_at + config::lorawan_sending_interval)) {
if (connected && (now - last_sent_at > config::lorawan_sending_interval)) {
last_sent_at = now;
preparePayload(co2, temperature, humidity);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment