Map sampling 1ms (best) or 2ms (good too).
map_processing() every event (best), or every rev (good too)
- //sensor_filt[MAP] = 2 * map_samples_summ / map_samples_count;
- void map_processing(void)
- {
- uint16_t t16;
- uint32_t t32;
- t16 = div_65535_x(map_samples_count);
- t32 = mult16_16(map_samples_summ,t16);
- sensor_filt[MAP] = t32 >> 15;
- map_samples_summ = 0;
- map_samples_count = 0;
- }
- has about 3us execute CPU time
So ADC sample rate 1ms, i made every 2nd ADC reading for MAP, (exept time while WBO sampling). And average readings for trigger to trigger period.
For debug purposes i have two config constants: minimum samples for averaging (=10 for now) and trigger perionds (=1 for now)