AirGradient Forum

AirGradient DIY PRO (PCB >3.7) 2.4.1 2023.04.13 Source Code/Sketch?

Hey,
I recently recieved the pre-solddered 4.2 kit and out of the box it worked great. I went to make some mods in Arduino and noticed several issues when flashing the example sketch provided.

There must be some difference between the binaries that I can flash via the web flash tool, which is labelled:
“AirGradient DIY PRO (PCB >3.7) 2.4.1 2023.04.13”
and what is on GitHub under
“examples/DIY_PRO_V4_2/DIY_PRO_V4_2.ino”

When I flash via the web tool, everything works fine, but when I manually flash with this example sketch, the display is upside-down and the device bootloops because the button configuration is incorrect (it keeps thinking the button is in the wrong state of high vs low).

Can someone please provide the source sketch that was used to create the binary that the web tool uses?

Thanks,

1 Like

I think I figured it out, it looks like the last commit to github overwrote the 4.2 code with the 3.7 code.
This previous commit seems to be more legit. Can anyone confirm if this is the latest sketch?

1 Like

This is definitely closer, but still not the most updated. I think there is definitely just a git error here.

We are looking into this. In case you have the display upside down check below code in the Arduino library and choose the correct line:

Yeah I tried changing that but it didn’t work. I ended up just fixing all the code myself based off the older GitHub commit, let me know if you want me to do a PR. It was trivial overall, but a bit confusing at first.

Echo everything @funkedope has experienced/found, though for me the display was already the correct orientation with both the current/incorrect (3.7 posing as 4.2) and old/correct (4.2 prior to commit 6314e52) firmware.

My question: were some of the changes to 4.2 firmware in the most recent commit (6314e52, 13 Apr) intentional?

Thank you!

Hello, I just flashed my mine from the example code in the IDE, and I am now also stuck in the endless bootloop. I see that the Github repo has not had commits since April or commented on the bug in the tracker there.
Airgradient, what is the timeline to fix this? The user impact here is big–total device failure–and it seems like the fix should be trivial. Is there some reason you can’t either copy the working version of the code from the web buttons or revert the repo to the last working version?

What is the version number on your board and which sketch did you flash?

Hey all, I don’t have the “fixed” code, I don’t recall exactly what I changed, but it was simple. I wrote some cfw for my setup to go to InfluxDB, along with some other custom code. I believe another user also has an InfluxDB version floating around that works.
I did push it to GitHub. When I have some free time I can go in and diff this with the official githhub file I posted above.
IIRC the reverted github code was pretty close.

I can’t say with 100% certainty this has all the features / works as intended, I didn’t test anything other than my specific setup, but it has been populating my InfluxDB correctly for a few weeks now.

Here is the repo: GitHub - FunkeDope/airgradient-pre-soldered-4.2-influxdb: Mod of the 4.2 pre-soldered to push to an InfluxDB 2 instance

1 Like

Hi. Just received my Pro pre-soldered and tried flashing it following the documentation and experience the same issue. Using the Arduino IDE, it looks like the file in File, Example, AirGradient and select the DIY_PRO_V4_2 code is in fact V3_7, as hinted by the top comment:

/*
Important: This code is only for the DIY PRO PCB Version 3.7 that has a push button mounted.

This is also the latest code available on Github.

An issue has been opened about this on Github: Flashing via Web and Arduino yield different results (DIY Pro 4.2) · Issue #30 · airgradienthq/arduino · GitHub

A previous version of the code https://github.com/airgradienthq/arduino/blob/cfc37d2d96e6a761740d672238f3bc2e08498a11/examples/DIY_PRO_V4_2/DIY_PRO_V4_2.ino seems to work fine, at least for me.

@Achim_AirGradient I see this issue happened a few month ago already. Any chance we could just revert to the previous version?

1 Like

There are a lot of pending PRs on the github repo in general, I don’t know if it is actively being maintained.

My board is 4.2. It’s a brand new unit, but I was running a manual calibration. I experienced boot loop when I flashed the 4.2 code currently provided in the instructions. I was later able to flash it using the web button, which says it’s version 3.7, as others have noted here.

I am currently traveling and do not have all the boards with me for testing. I will look into this when I am back.

In general the Arduino library needs quite some update and refactoring and checking all the PRs but we are currently really stretched with resources. So in case somebody wants to help, please contact me.