-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add timeout handling for RG15 #22768
Conversation
// if the parsing wasn't completely successful then skip the update | ||
if( !isnan(Rg15.acc) && !isnan(Rg15.event) && !isnan(Rg15.total) && !isnan(Rg15.rate) ) { | ||
ResponseAppend_P(PSTR(",\"" RG15_NAME "\":{")); | ||
ResponseAppend_P(PSTR("\"%s\":%s,"), D_JSON_VALID, &aString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
ResponseAppend_P(PSTR("\"%s\":%d,"), D_JSON_VALID, Rg15.isSensorAvailable);
and getting rid off BOOL_TO_STRING and supporting code.
ResponseAppend_P(PSTR("\"%s\":%2_f,"), D_JSON_ACTIVE, &Rg15.acc); | ||
ResponseAppend_P(PSTR("\"%s\":%2_f,"), D_JSON_EVENT, &Rg15.event); | ||
ResponseAppend_P(PSTR("\"%s\":%2_f,"), D_JSON_TOTAL, &Rg15.total); | ||
ResponseAppend_P(PSTR("\"%s\":%2_f"), D_JSON_FLOWRATE, &Rg15.rate); | ||
ResponseAppend_P(PSTR("}")); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls remove the else clause; Having Valid with the other values makes enough sense (and saves code space).
Thx. Based on your work I will update the driver with your suggested functionality. You don't have to respond to the questions I asked today. Hold on.... |
(Some kind of) Merged in latest branch |
Thanks! |
Description:
Add timeout handling for RG15 (rain sensor).
Related issue (if applicable): fixes #
Rainsensor Optical Rain Gauge RG-15 #22612
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass