Skip to content

Commit

Permalink
inverter-cli/mail.cpp: align the implementation to the protocol
Browse files Browse the repository at this point in the history
The HS_MS_MSX protocol specification in the repository says for the

QPIRI command value R is “Parallel max num”.

On my system R returns 9, while the source code expected "-" in scanf().

This change alters the input of scanf() to accept any character in
the position for R.

Closes ned-kelly#71
  • Loading branch information
dilyanpalauzov committed Mar 13, 2022
1 parent 0ddffda commit 6a700b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sources/inverter-cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ int main(int argc, char* argv[]) {

// Parse and display values
sscanf(reply1->c_str(), "%f %f %f %f %d %d %d %d %f %d %d %d %f %f %f %d %s", &voltage_grid, &freq_grid, &voltage_out, &freq_out, &load_va, &load_watt, &load_percent, &voltage_bus, &voltage_batt, &batt_charge_current, &batt_capacity, &temp_heatsink, &pv_input_current, &pv_input_voltage, &scc_voltage, &batt_discharge_current, &device_status);
sscanf(reply2->c_str(), "%f %f %f %f %f %d %d %f %f %f %f %f %d %d %d %d %d %d - %d %d %d %f", &grid_voltage_rating, &grid_current_rating, &out_voltage_rating, &out_freq_rating, &out_current_rating, &out_va_rating, &out_watt_rating, &batt_rating, &batt_recharge_voltage, &batt_under_voltage, &batt_bulk_voltage, &batt_float_voltage, &batt_type, &max_grid_charge_current, &max_charge_current, &in_voltage_range, &out_source_priority, &charger_source_priority, &machine_type, &topology, &out_mode, &batt_redischarge_voltage);
char parallel_max_num;
sscanf(reply2->c_str(), "%f %f %f %f %f %d %d %f %f %f %f %f %d %d %d %d %d %d %c %d %d %d %f",
&grid_voltage_rating, &grid_current_rating, &out_voltage_rating, &out_freq_rating, &out_current_rating, &out_va_rating, &out_watt_rating, &batt_rating, &batt_recharge_voltage, &batt_under_voltage, &batt_bulk_voltage, &batt_float_voltage, &batt_type, &max_grid_charge_current, &max_charge_current, &in_voltage_range, &out_source_priority, &charger_source_priority, &parallel_max_num, &machine_type, &topology, &out_mode, &batt_redischarge_voltage);

// There appears to be a discrepancy in actual DMM measured current vs what the meter is
// telling me it's getting, so lets add a variable we can multiply/divide by to adjust if
Expand Down

0 comments on commit 6a700b9

Please sign in to comment.