refactor Functions to group everything connected to the vehicle to a central location
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "BSP_GPIO.h"
|
||||
|
||||
#include "CanDataTask.h"
|
||||
#include "Vehicle.h"
|
||||
#include "BSP_ADC.h"
|
||||
#define DIMM_DEADZONE_VOLTAGE 0.7
|
||||
|
||||
@@ -82,14 +83,14 @@ void LightTask_func(void *argument) {
|
||||
|
||||
|
||||
|
||||
float dimmfactor = 1.0;
|
||||
uint8_t dimm = 255;
|
||||
|
||||
// currenlty not working
|
||||
// only dimm if the headlight is on
|
||||
if (BSP_GPIO_HeadLightIsSet()) {
|
||||
//if (Vehicle_isHeadlightOn()) {
|
||||
|
||||
// new version over CAN
|
||||
uint8_t precent = CanDataTask_CarCanBrightness();
|
||||
dimmfactor = (float)precent / 100.0;
|
||||
//dimm = Vehicle_Brightness();
|
||||
|
||||
// old version over ADC
|
||||
// calculate the dimmfactor based on the battery voltage and the dimmer voltage
|
||||
@@ -104,9 +105,10 @@ void LightTask_func(void *argument) {
|
||||
//} else {
|
||||
// dimmfactor = (v_dimm - 4.0) / (v_bus - 4.0);
|
||||
//}
|
||||
}
|
||||
|
||||
uint8_t adjustedBrightness = (uint8_t)(brightness * dimmfactor);
|
||||
//}
|
||||
|
||||
uint8_t adjustedBrightness = (brightness * dimm)/ 255;
|
||||
lightSettings_dimmed.brightness = adjustedBrightness;
|
||||
lightSettings_dimmed.theme = lightSettings.theme;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user