Next try to fix the miss behavior (keeping light on or increasing brightness on ch1).

This commit is contained in:
Kai Lauterbach 2023-05-15 07:59:35 +02:00
parent bdf6765687
commit cc88a0de0b
5 changed files with 12 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 MiB

View file

@ -64,10 +64,9 @@ void lightEngine()
//Serial.println("Reached target bri[" + (String)i + "] = " + (String)bri[i]);
}
uint16_t tmp_pwm = calcPWM(current_bri[i]);
current_pwm[i] = tmp_pwm;
current_pwm[i] = calcPWM(current_bri[i]);
//Serial.println("lon: pin" + (String)i + " = PWM(" + (String)tmp_pwm + ")");
analogWrite(pins[i], tmp_pwm);
analogWrite(pins[i], current_pwm[i]);
}
} else { // light state is off
@ -82,10 +81,9 @@ void lightEngine()
//Serial.println("Reached target bri[" + (String)i + "] = " + (String)bri[i]);
}
uint16_t tmp_pwm = calcPWM(current_bri[i]);
current_pwm[i] = tmp_pwm;
current_pwm[i] = calcPWM(current_bri[i]);
//Serial.println("loff: pin" + (String)i + " = PWM(" + (String)tmp_pwm + ")");
analogWrite(pins[i], tmp_pwm);
analogWrite(pins[i], current_pwm[i]);
}
}

View file

@ -184,9 +184,9 @@ void tc_update_main()
// disable the lights
for (uint8_t i = 0; i < LIGHTS_COUNT; i++)
{
light_state[i] = false;
bri[i] = 0;
current_bri[i] = 0;
current_pwm[i] = 0;
current_bri[i] = 4; // set it to a value which forces the light wngine to switch of the pwm signal pf the gpio
transitiontime[i] = default_transitiontime;
process_lightdata(i, transitiontime[i]);
}
@ -206,17 +206,19 @@ void tc_update_main()
if (target_data_block >= NUMBER_OF_TIMER_DATA_BLOCKS)
{
// we are not between two valid data points, do nothing
Serial.println("tdb is >= num data blocks, abort operation...");
// we are not between two valid data points
// we are at the last element of the data block list
Serial.println("tdb is beyond data blocks length, abort operation");
for (uint8_t i = 0; i < LIGHTS_COUNT; i++)
{
light_state[i] = false;
bri[i] = 0;
current_bri[i] = 0;
current_pwm[i] = 0;
current_bri[i] = 4; // set it to a value which forces the light wngine to switch of the pwm signal pf the gpio
transitiontime[i] = default_transitiontime;
process_lightdata(i, transitiontime[i]);
}
target_data_block = 255;
current_target_data_block = 255;
return;