Avoid floating point operations.
This commit is contained in:
@ -188,8 +188,9 @@ void HandleRotate(Direction dir, int val) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint32_t mod_pulses = clock_mod_pulses[ch->clock_mod_index];
|
uint32_t mod_pulses = clock_mod_pulses[ch->clock_mod_index];
|
||||||
ch->duty_cycle_pulses = max(int(float(mod_pulses) * (1.0 - (float(ch->duty_cycle) / 100.0))), 1);
|
ch->duty_cycle_pulses = max( (int)( (mod_pulses * (100L - ch->duty_cycle)) / 100L ), 1 );
|
||||||
ch->offset_pulses = int(float(mod_pulses) * (float(ch->offset) / 100.0));
|
ch->offset_pulses = (int)(mod_pulses * (100L - ch->offset) / 100L);
|
||||||
|
|
||||||
app.refresh_screen = true;
|
app.refresh_screen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user