COAST-Lab / Biogeochemical-Drifter

All code and documentation of Stephen Lail's Master's project
0 stars 1 forks source link

Water Quality sensors reading 0 #10

Open Stephen-Lail opened 3 days ago

Stephen-Lail commented 3 days ago

I think I may have found the issue with the code. Around line 30 in the .cpp file, I have float last_ph = 0.0 and similar floats for the other readings. Would this line cause the sensor issues?

SUPScientist commented 2 days ago

I assume you mean this chunk, correct? https://github.com/COAST-Lab/Biogeochemical-Drifter/blob/0846e766e49fa8ac66b0f89e48320029c7e35019/Firmware/Drifter_Code_V2/src/Drifter_Code_V2.cpp#L25-L28 (Side note, whenever possible, please use the GitHub copy permalink option and paste it into the issue so that there's no ambiguity. I can show you how to do this if you're unfamiliar with the technique.)

In short, no, those lines alone wouldn't be the issue given that in that location you're just defining and initializing global variables. As long as values are later (re)assigned to them, the new values will supersede the zeros. I'm not certain if this condition is met. last_ph is indeed reassigned in step4(), but it's unclear to me if step4() is called since I don't completely follow the code structure.

Can you reference another example where there is just water quality sensing (i.e., no GPS/cell) but where we got the water quality probes to respond and follow that way of calling the step4 and sequencer4 functions (and anything related)?

Stephen-Lail commented 2 days ago

I fixed it based on older code I had written and accidently cut while reworking the datalogging portion. its only problem now is it "stammers" when in the serial monitor. image I believe I can fix this by removing the Serial.print("DO: "); statement throughout step 4. I dont know how to show you the exact segments/lines i am talking about

SUPScientist commented 2 days ago

Great work!

OK, if I'm understanding what you mean by stammering, it's probably what you already think it is too, but it looks like your solution will work since you also have it serial printing here:
https://github.com/COAST-Lab/Biogeochemical-Drifter/blob/635343286882b9a420108fdfa6ab102f7f15cc58/Firmware/Drifter_Code_V2/src/Drifter_Code_V2.cpp#L508

SUPScientist commented 2 days ago

BTW, the way to embed code like I'm suggesting is to go to the code in the online repository, click on the line number of the first line of code you want (and if you want more lines, then SHIFT+click on the last line of code you want). Then three dots will appear and after clicking those, select "Copy Permalink."

image

This is a super powerful tool for collaborative firmware and data analysis code debugging.