Add more precision to reported roller speeds

master
Tom Wilson 4 years ago
parent d21d098a78
commit 913e4c7cd5

@ -303,15 +303,15 @@ void loop() {
// being driven with. [motor_current] is an estimated average current draw of the motor in amps (a float). // being driven with. [motor_current] is an estimated average current draw of the motor in amps (a float).
// Floats are given with 2 digits after the decimal (dynamic before the decimal) // Floats are given with 2 digits after the decimal (dynamic before the decimal)
sprintf(msg_buffer, "%lu %d %.2f %.2f %.2f %.2f 0.00", now, motor_status.motor_1_control.enabled, sprintf(msg_buffer, "%lu %d %.2f %.3f %.3f %.2f 0.00", now, motor_status.motor_1_control.enabled,
motor_status.motor_1_control.desired_speed, motor_status.roller_1_speed, motor_status.roller_1_revs, motor_status.motor_1_control.desired_speed, motor_status.roller_1_speed, motor_status.roller_1_revs,
motor_status.motor_1_duty); motor_status.motor_1_duty);
mqtt_client.publish("airseeder/status/roller1", msg_buffer, true); mqtt_client.publish("airseeder/status/roller1", msg_buffer, true);
sprintf(msg_buffer, "%lu %d %.2f %.2f %.2f %.2f 0.00", now, motor_status.motor_2_control.enabled, sprintf(msg_buffer, "%lu %d %.2f %.3f %.3f %.2f 0.00", now, motor_status.motor_2_control.enabled,
motor_status.motor_2_control.desired_speed, motor_status.roller_2_speed, motor_status.roller_2_revs, motor_status.motor_2_control.desired_speed, motor_status.roller_2_speed, motor_status.roller_2_revs,
motor_status.motor_2_duty); motor_status.motor_2_duty);
mqtt_client.publish("airseeder/status/roller2", msg_buffer, true); mqtt_client.publish("airseeder/status/roller2", msg_buffer, true);
sprintf(msg_buffer, "%lu %d %.2f %.2f %.2f %.2f 0.00", now, motor_status.motor_3_control.enabled, sprintf(msg_buffer, "%lu %d %.2f %.3f %.3f %.2f 0.00", now, motor_status.motor_3_control.enabled,
motor_status.motor_3_control.desired_speed, motor_status.roller_3_speed, motor_status.roller_3_revs, motor_status.motor_3_control.desired_speed, motor_status.roller_3_speed, motor_status.roller_3_revs,
motor_status.motor_3_duty); motor_status.motor_3_duty);
mqtt_client.publish("airseeder/status/roller3", msg_buffer, true); mqtt_client.publish("airseeder/status/roller3", msg_buffer, true);

Loading…
Cancel
Save