Closed SUPScientist closed 1 month ago
@gracelower, this would be a great next issue for you to tackle (after chassis updates/during printing).
Recommended approach:
@SUPScientist Sounds good - I'll get to this ASAP!
Solution for errors in Line 255:
Updated code with Log.info statements and adjusted Getting_Started instructions (in Firmware folder) to reflect these changes https://github.com/COAST-Lab/Open-Water-Level/commit/c8fbb673e3e3e8fefc8327921a47488ecf37b049
New proposal: combination of Serial.print + Log.info statements
A WORK-IN-PROGRESS
file was created in the Firmware > SLRMaxbotix... folder to house code that combines these two statement types. Resulting zeros in the data are only for battery voltage and battery level (due to the device being powered by a computer, not battery).
Please note that part of this proposal was generated in part by AI.
Everything sounds like it's on the right trajectory till this last comment that starts "New proposal." Not sure I follow. The goal is to switch completely away from Serial.print()
type statements and use only Log.info()
type statements, so I don't think the combo idea is what we want.
I think the issue is that I disagree with the last bullet of your AI-generated proposal
"If you want to ensure that a message is seen both locally and remotely, use both Serial.print and Log.info for the same message"
Log.info()
will print to screen in my understanding.
I had initially switched all Serial.print
statements to Log.info
statements to eliminate all instances of Serial.print as you mentioned. The code compiled and flashed successfully, but I ran into a problem where no results were being returned at all to the serial monitor, instead simply showing the serial monitor opening and closing. When I added some of the Serial.print
statements back into the code, I was able to see data in the serial monitor once more.
I will do some more research on this and refer back to the Particle Community forum for ways to navigate this issue without reinstating any Serial.print statements. Thanks!
Added SerialLogHandler logHandler;
to Global objects list before void_setup(void) {
Log.info("Sleeping for %i", seconds_to_sleep);
Changes staged; will commit & submit pull request once current pull request is merged.
Pull request https://github.com/COAST-Lab/Open-Water-Level/pull/45 addresses this issue
Agreed. https://github.com/COAST-Lab/Open-Water-Level/pull/45 solves the issue. Closing. Nice work!
Problem
Firmware currently uses
Serial.print()
type statements frequently.Solution
Log.info()
type statements. However, it's not as simple as just a text-based find and replace operation.