Added Led Fet switch to be switched on with Led

Changed temp calibration
This commit is contained in:
Gernot Hehn
2022-05-16 19:03:20 +02:00
parent 1161ed6c42
commit f315a8c1f9
5 changed files with 22 additions and 7 deletions

5
.gitignore vendored
View File

@ -3,3 +3,8 @@ CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
*.bin
*.hex
*.elf
*.a
*.map

View File

@ -41,8 +41,8 @@
* Then you can verify voltage on value 6 (to get calibrated voltage multiplied by 100).
*/
#define BAT_FILT_COEF 655 // battery voltage filter coefficient in fixed-point. coef_fixedPoint = coef_floatingPoint * 2^16. In this case 655 = 0.01 * 2^16
#define BAT_CALIB_REAL_VOLTAGE 3970 // input voltage measured by multimeter (multiplied by 100). For example 43.00 V * 100 = 4300
#define BAT_CALIB_ADC 1492 // adc-value measured by mainboard (value nr 5 on UART debug output)
#define BAT_CALIB_REAL_VOLTAGE 4800 // input voltage measured by multimeter (multiplied by 100). For example 43.00 V * 100 = 4300
#define BAT_CALIB_ADC 1845 // adc-value measured by mainboard (value nr 5 on UART debug output)
#define BAT_CELLS 12 // battery number of cells. Normal Hoverboard battery: 10s
@ -54,10 +54,10 @@
* Enable warning and/or poweroff and make and flash firmware.
*/
#define TEMP_FILT_COEF 655 // temperature filter coefficient in fixed-point. coef_fixedPoint = coef_floatingPoint * 2^16. In this case 655 = 0.01 * 2^16
#define TEMP_CAL_LOW_ADC 1655 // temperature 1: ADC value
#define TEMP_CAL_LOW_DEG_C 358 // temperature 1: measured temperature [°C * 10]. Here 35.8 °C
#define TEMP_CAL_HIGH_ADC 1588 // temperature 2: ADC value
#define TEMP_CAL_HIGH_DEG_C 489 // temperature 2: measured temperature [°C * 10]. Here 48.9 °C
#define TEMP_CAL_LOW_ADC 1593 // temperature 1: ADC value
#define TEMP_CAL_LOW_DEG_C 400 // temperature 1: measured temperature [°C * 10]. Here 40.0 °C
#define TEMP_CAL_HIGH_ADC 1463 // temperature 2: ADC value
#define TEMP_CAL_HIGH_DEG_C 623 // temperature 2: measured temperature [°C * 10]. Here 62.3 °C
// ############################### INPUT ###############################

View File

@ -185,6 +185,9 @@
#define LED_PIN GPIO_PIN_2
#define LED_PORT GPIOB
#define LIGHT_PIN GPIO_PIN_3
#define LIGHT_PORT GPIOB
#define BUZZER_PIN GPIO_PIN_4
#define BUZZER_PORT GPIOA

View File

@ -1050,6 +1050,10 @@ void MX_GPIO_Init()
GPIO_InitStruct.Pin = LED_PIN;
HAL_GPIO_Init(LED_PORT, &GPIO_InitStruct);
GPIO_InitStruct.Pin = LIGHT_PIN;
HAL_GPIO_Init(LIGHT_PORT, &GPIO_InitStruct);
__HAL_AFIO_REMAP_SWJ_NOJTAG();
GPIO_InitStruct.Pin = BUZZER_PIN;
HAL_GPIO_Init(BUZZER_PORT, &GPIO_InitStruct);
@ -1392,6 +1396,7 @@ void communicationTimeout()
buzzer.pattern = 1;
HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_RESET);
HAL_GPIO_WritePin(LIGHT_PORT, LIGHT_PIN, GPIO_PIN_RESET);
}
#ifdef MOTOR_TEST
@ -1497,6 +1502,7 @@ void parseCommand()
#endif
HAL_GPIO_WritePin(LED_PORT, LED_PIN, command.led ? GPIO_PIN_RESET : GPIO_PIN_SET);
HAL_GPIO_WritePin(LIGHT_PORT, LIGHT_PIN, command.led ? GPIO_PIN_SET : GPIO_PIN_RESET);
command.start = Command::INVALID_HEADER; // Change the Start Frame for timeout detection in the next cycle
timeoutCntSerial = 0; // Reset the timeout counter
@ -1645,6 +1651,7 @@ void applyIncomingCanMessage()
case MotorController<isBackBoard, false>::Command::Led:
case MotorController<isBackBoard, true> ::Command::Led:
HAL_GPIO_WritePin(LED_PORT, LED_PIN, *((bool*)buf) ? GPIO_PIN_SET : GPIO_PIN_RESET);
HAL_GPIO_WritePin(LIGHT_PORT, LIGHT_PIN, *((bool*)buf) ? GPIO_PIN_SET : GPIO_PIN_RESET);
break;
case MotorController<isBackBoard, false>::Command::Poweroff:
case MotorController<isBackBoard, true>::Command::Poweroff: