Min/max recordings added to serial pub message

This commit is contained in:
Martin Jaeger
2019-04-17 08:18:44 +02:00
parent 73a205f60f
commit 666ca02baf
4 changed files with 13 additions and 2 deletions
+2
View File
@@ -192,6 +192,8 @@ const uint16_t pub_serial[] = {
0x74, 0x76, 0x77, // temperatures
0x04, 0x78, 0x79, // LoadState, ChgState, DCDCState
0xA0, 0xA1, 0xA2, 0xA3, // daily energy throughput
0x0F, 0x10, // SolarMaxDay_W, LoadMaxDay_W
0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, // V, I, T max
0x06, 0xA4 // SOC, coulomb counter
};
+3 -1
View File
@@ -60,10 +60,12 @@ void uart_serial_init(Serial* s)
s->attach(uart_serial_isr);
}
extern const int PUB_CHANNEL_SERIAL;
void uart_serial_pub()
{
if (pub_uart_enabled) {
ts.pub_msg_json((char *)buf_resp, sizeof(buf_resp), 4);
ts.pub_msg_json((char *)buf_resp, sizeof(buf_resp), PUB_CHANNEL_SERIAL);
ser_uart->printf("%s\n", buf_resp);
}
}
+2 -1
View File
@@ -87,7 +87,8 @@ bool pwm_switch_enabled()
}
float pwm_switch_get_duty_cycle() {
return (float)(TIM3->CCR4) / (_pwm_resolution);;
// TODO: check why we might get > 100
return (float)(TIM3->CCR4) / (_pwm_resolution);
}
void pwm_switch_start(float pwm_duty)
+6
View File
@@ -59,4 +59,10 @@ void pwm_switch_duty_cycle_step(int delta);
bool pwm_switch_enabled();
/** Read the currently set duty cycle
*
* @returns Duty cycle between 0.0 and 1.0
*/
float pwm_switch_get_duty_cycle();
#endif /* PWM_SWITCH_H */