OpenSprinkler Forums OpenSprinkler Unified Firmware Flow, Rain, Soil Sensor Inputs, Current Sensor Reply To: Flow, Rain, Soil Sensor Inputs, Current Sensor

#45318

Csaba Toth
Participant

I have found the solution.
The op_json_names list have to be synchronized with the option list.

Now I have flow, current logs on the SD card, the code part:

ultoa(curr_time, tmp_buffer+strlen(tmp_buffer), 10);
if((os.options[OPTION_SENSOR_TYPE]==SENSOR_TYPE_FLOW) && (type==LOGDATA_STATION)) {
// RAH implementation of flow sensor at the end of all progammed station cycle
strcat_P(tmp_buffer, PSTR(“,”));
#if defined(ARDUINO)
dtostrf(flow_last_gpm,5,2,tmp_buffer+strlen(tmp_buffer)); //the flow log
strcat_P(tmp_buffer, PSTR(“,”));
ultoa(os.read_current(), tmp_buffer+strlen(tmp_buffer), 10); //the current log
#else
sprintf(tmp_buffer+strlen(tmp_buffer), “%5.2f”, flow_last_gpm);
#endif
}
strcat_P(tmp_buffer, PSTR(“]\r\n”));

The log record looks like this:

[254,0,60,1485681437,121.70,296]

Program once, station1, 60 seconds, unix time, liter per minute, current milliamper.