>>> Join Us in the Fight Against Air Pollution

AirGradient Forum

CO2-LEDs flash about once a minute after compilation of 3.1.9

EDIT: Look at the bold-section, maybe that’s the reason…
EDIT2: Found the solution. See answer below.

I tried to compile the firmware myself.
So, I installed the Arduino IDE with help of the blog-article

But there must be one issue on my side, because after successful verify, compile and upload the LEDs started to flash about once a minute. It’s a very short flash (< 1 sec), but it is something that with the stock firmware did not appear.
The only log-entry I found at the moment of the flickering is from ApiClient:

[ApiClient] Info: GET: http://hw.airgradient.com/sensors/airgradient:xxxx/one/config
 [ApiClient] Info: Return code: 200
 [Configure] Info: Parse configure: {"country":"xx","pmStandard":"ugm3","co2CalibrationRequested":false,"ledBarTestRequested":false,"ledBarMode":"co2","displayMode":"on","placeOpen":false,"abcDays":8,"tvocLearningOffset":720,"noxLearningOffset":12,"temperatureUnit":"c","targetFirmware":"3.1.9","ledBarBrightness":80,"displayBrightness":80,"model":"I-9PSL"}
 [Configure] Info: Parse configure success
[Configure] Info: Detected new firmware version: 3.1.9

Maybe something with the firmware-version, because “my” firmware is 3.1.9-snap as reported by the monitor?

Another issue with the LEDs: Sometimes (only with my uploaded firmware) all LEDs went off for 1-2 seconds and then back on. That appears very seldom. There seems to be a timeout, because that’s written to the log at this moment.

I tried it with three different monitors. Every time I flash my own compiled (but nothing changed) firmware the flickering started, if I go back to stock firmware 3.1.9 it stops.

This are my settings:

and the following compilation settings:

I also tried with CPU-Speed 80 Hz, but as @Achim_AirGradient wrote in another thread he also uses 160 Hz.

I removed the complete air gradient-Library and reinstalled it. But the flickering stays.

Thanks for help.

I found the solution myself:

It was indeed the version number. In “airgradient.h” the GIT_VERSION will be defined:

#ifndef GIT_VERSION
#define GIT_VERSION "3.1.9-snap"
#endif

And the GIT_VERSION will be predefined at compile time in “platformio.ini”:

build_flags = !echo '-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 -D GIT_VERSION=\\"'$(git describe --tags --always --dirty)'\\"'

If I clone the repository the variable GIT_VERSION will be set to “3.1.9”. But if I load the library into the Arduino IDE the variable seems not to be set. So the above ifndef…endif will result in GIT_VERSION = 3.1.9-snap.

If I change the line in the “airgradient.h” to #define GIT_VERSION “3.1.9” the “flickering” is gone.

It seems that the OTA-Update-function did not work as correctly, if I build a firmware myself. But I don’t know whether this is intentional or not.

@Achim_AirGradient Is this intentional?
And are there any problems with my solution?

Thanks.