integer calc

This commit is contained in:
Wolfgang Hottgenroth 2021-02-07 22:50:11 +01:00
parent 8ae5831620
commit 0b1c0fda48
Signed by: wn
GPG Key ID: E49AF3B9EF6DD469

View File

@ -42,12 +42,13 @@ void second_tick(void *handle) {
mainsCntCnt = 0; mainsCntCnt = 0;
HAL_NVIC_EnableIRQ(TIM1_CC_IRQn); HAL_NVIC_EnableIRQ(TIM1_CC_IRQn);
uint32_t cnt = tmpSum / tmpCnt; uint64_t cnt = tmpSum / tmpCnt;
double f = 1.0 / ((double)cnt) * 1.0e6; // double f = 1.0 / ((double)cnt) * 1.0e6;
uint32_t ff = (uint32_t) ((f + 0.005) * 100); uint64_t freq = 100 * 1.0e6 / cnt;
// uint32_t ff = (uint32_t) ((f + 0.005) * 100);
t_seconds *seconds = wizGetSeconds(); t_seconds *seconds = wizGetSeconds();
coloredMsg(LOG_GREEN, "Tick %ld %f %d %lu %lu", ff, f, seconds->valid, seconds->missedUpdates, seconds->seconds); coloredMsg(LOG_GREEN, "Tick %lu %d %lu %lu", freq, seconds->valid, seconds->missedUpdates, seconds->seconds);
} }