diff --git a/src/state.c b/src/state.c index 273709b..1f3a73f 100644 --- a/src/state.c +++ b/src/state.c @@ -13,17 +13,18 @@ uint16_t current_power = 0; uint16_t target_power = 0; #define RAMP_PERIOD_MS 1 -#define RAMP_STEP 200 +#define RAMP_STEP_UP 200 +#define RAMP_STEP_DOWN 50 // Timer and callback for ramping power. Jumping ~50% power or more in one go kills the // chip with electrical ripples, so be a bit gentle about it. static btstack_timer_source_t ramp_timer; static void ramp_timer_callback(struct btstack_timer_source* ts) { if (current_power != target_power) { - if (current_power < target_power - RAMP_STEP) { - current_power += RAMP_STEP; - } else if (current_power > target_power + RAMP_STEP) { - current_power -= RAMP_STEP; + if (current_power < target_power - RAMP_STEP_UP) { + current_power += RAMP_STEP_UP; + } else if (current_power > target_power + RAMP_STEP_DOWN) { + current_power -= RAMP_STEP_DOWN; } else { current_power = target_power; }