Print log data over UART

This commit is contained in:
Thomas Kolb 2016-08-14 04:17:06 +02:00
parent 71c7cb57be
commit 2246ac0290
1 changed files with 27 additions and 63 deletions

View File

@ -325,6 +325,33 @@ static void init_systick(int freq)
}
#endif
static void report_status(fxp_t vin, fxp_t vout, fxp_t current,
int32_t pwm, enum OperState operState)
{
char number[FXP_STR_MAXLEN];
debug_send_string("DATA:");
fxp_format(vin, number, 3);
debug_send_string(number);
debug_send_string(":");
fxp_format(vout, number, 3);
debug_send_string(number);
debug_send_string(":");
fxp_format(current, number, 3);
debug_send_string(number);
debug_send_string(":");
fxp_format_int(pwm, number);
debug_send_string(number);
debug_send_string(":");
fxp_format_int((int32_t)operState, number);
debug_send_string(number);
debug_send_string("\r\n");
}
int main(void)
{
@ -711,69 +738,6 @@ int main(void)
}
}
if((timebase_ms % 500) == 0) {
debug_send_string("ADC:");
for(uint8_t i = 0; i < ADC_NUM_CHANNELS; i++) {
fxp_format_int(adc_values[i], msg);
debug_send_string(" ");
debug_send_string(msg);
}
sentSomething = 1;
}
if((timebase_ms % 500) == 100) {
debug_send_string("pErr=");
fxp_format(pErr, msg, 3);
debug_send_string(msg);
debug_send_string("; iErr=");
fxp_format(iErr, msg, 3);
debug_send_string(msg);
debug_send_string("; action=");
fxp_format(controlAction, msg, 1);
debug_send_string(msg);
sentSomething = 1;
}
if((timebase_ms % 500) == 200) {
debug_send_string("power_avg=");
fxp_format(power_avg, msg, 2);
debug_send_string(msg);
debug_send_string("; ref=");
fxp_format(refPower, msg, 2);
debug_send_string(msg);
debug_send_string("; pwm=");
fxp_format_int(pwm, msg);
debug_send_string(msg);
sentSomething = 1;
}
if((timebase_ms % 500) == 300) {
debug_send_string("RTC seconds: ");
fxp_format_int((RTC_TR >> RTC_TR_SU_SHIFT) & RTC_TR_SU_MASK, msg);
debug_send_string(msg);
debug_send_string(" - ALRAF: ");
fxp_format_int(RTC_ISR & RTC_ISR_ALRAF, msg);
debug_send_string(msg);
debug_send_string(" - EXTI17: ");
fxp_format_int(exti_get_flag_status(EXTI17), msg);
debug_send_string(msg);
sentSomething = 1;
}
if(sentSomething) {
debug_send_string("\r\n");
sentSomething = 0;