use const brightness
This commit is contained in:
@@ -77,19 +77,19 @@ void LightTask_func(void *argument) {
|
|||||||
|
|
||||||
|
|
||||||
// calculate the brightness to send
|
// calculate the brightness to send
|
||||||
uint8_t brightness = lightSettings.brightness;
|
//uint8_t brightness = lightSettings.brightness;
|
||||||
// Read ADC battery voltage and dimmer voltage
|
// Read ADC battery voltage and dimmer voltage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
float dimmfactor = 1.0;
|
//float dimmfactor = 1.0;
|
||||||
|
|
||||||
// only dimm if the headlight is on
|
// only dimm if the headlight is on
|
||||||
if (BSP_GPIO_HeadLightIsSet()) {
|
//if (BSP_GPIO_HeadLightIsSet()) {
|
||||||
|
|
||||||
// new version over CAN
|
// new version over CAN
|
||||||
uint8_t precent = CanDataTask_CarCanBrightness();
|
//uint8_t precent = CanDataTask_CarCanBrightness();
|
||||||
dimmfactor = (float)precent / 100.0;
|
//dimmfactor = (float)precent / 100.0;
|
||||||
|
|
||||||
// old version over ADC
|
// old version over ADC
|
||||||
// calculate the dimmfactor based on the battery voltage and the dimmer voltage
|
// calculate the dimmfactor based on the battery voltage and the dimmer voltage
|
||||||
@@ -106,12 +106,12 @@ void LightTask_func(void *argument) {
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t adjustedBrightness = (uint8_t)(brightness * dimmfactor);
|
//uint8_t adjustedBrightness = (uint8_t)(brightness * dimmfactor);
|
||||||
lightSettings_dimmed.brightness = adjustedBrightness;
|
//lightSettings_dimmed.brightness = adjustedBrightness;
|
||||||
lightSettings_dimmed.theme = lightSettings.theme;
|
//lightSettings_dimmed.theme = lightSettings.theme;
|
||||||
|
|
||||||
|
lightSettings.brightness = 255;
|
||||||
CLS_BSP_CAN_AddMessageToSend(&can_header,(uint8_t*)&lightSettings_dimmed);
|
CLS_BSP_CAN_AddMessageToSend(&can_header,(uint8_t*)&lightSettings);
|
||||||
|
|
||||||
if( settingChangeTime !=0 && tick > settingChangeTime + settingSaveTimeout) {
|
if( settingChangeTime !=0 && tick > settingChangeTime + settingSaveTimeout) {
|
||||||
BSP_EE24_PartWrite(BSP_EE24_PART_GLOBAL_LIGHT, (uint8_t*) &lightSettings, sizeof(lightSettings));
|
BSP_EE24_PartWrite(BSP_EE24_PART_GLOBAL_LIGHT, (uint8_t*) &lightSettings, sizeof(lightSettings));
|
||||||
|
|||||||
Reference in New Issue
Block a user