More cleanup and fixes in irq handling.

develop
sq2ips 2025-10-29 17:35:04 +01:00
rodzic 749772c1eb
commit c91f6d3af0
4 zmienionych plików z 14 dodań i 14 usunięć

Wyświetl plik

@ -63,6 +63,7 @@
"cstdint": "c",
"afsk.h": "c",
"main.h": "c",
"lps22hb.h": "c"
"lps22hb.h": "c",
"config.h": "c"
}
}

Wyświetl plik

@ -50,7 +50,6 @@ extern "C" {
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "stm32l0xx_it.h"
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/

Wyświetl plik

@ -171,12 +171,7 @@ void main_loop(void) {
LL_ADC_REG_SetSequencerChannels(ADC1, LL_ADC_CHANNEL_8);
LL_ADC_REG_StartConversion(ADC1);
while (LL_ADC_IsActiveFlag_EOC(ADC1) == 0) {}
// ADC voltage: 3.3V, divided by ADC max value 4095 (2^12-1). That gives a
// range between 0 for 0V and 1 for 3.3V. Than it's multiplied by max
// variable value: 255, and divided by corresponding voltage: 5V, simplified
// gives 187/4550 Note: this value will not go higher than 168 corresponding
// to 3.3V max value of ADC
BatVoltage = LL_ADC_REG_ReadConversionData12(ADC1);
BatVoltage = LL_ADC_REG_ReadConversionData12(ADC1); // Raw ADC value 0-4095
LL_ADC_ClearFlag_EOS(ADC1);
#if DEBUG
printf("Bat voltage value: %d\r\n", BatVoltage);
@ -311,6 +306,11 @@ DelayWithIWDG(2000); // ???
#endif
HorusPacket.Temp = LpsTemp;
// ADC voltage: 3.3V, divided by ADC max value 4095 (2^12-1). That gives a
// range between 0 for 0V and 1 for 3.3V. Than it's multiplied by max
// variable value: 255, and divided by corresponding voltage: 5V, simplified
// gives 187/4550 Note: this value will not go higher than 168 corresponding
// to 3.3V max value of ADC
HorusPacket.BatVoltage = (BatVoltage * 187) / 4550;
HorusPacket.ExtTemp = ExtTemp;
HorusPacket.Hum = 0; // Not implemented
@ -332,10 +332,6 @@ DelayWithIWDG(2000); // ???
#if GPS_WATCHDOG
if (GpsWatchdog.TriggerRestart) {
#if GPS_TYPE == 1
while (false) { // todo fix
LL_IWDG_ReloadCounter(IWDG);
LL_mDelay(100);
} // Wait for end of transmission (and for GPS module to start).
GpsAirborne(); // Send a command to GPS module to change to airborne mode.
// clear GPS buffer needed?
#endif

Wyświetl plik

@ -23,8 +23,12 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "config.h"
#if HORUS_ENABLE
#include "fsk4.h"
#endif
#if APRS_ENABLE
#include "afsk.h"
#endif
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@ -164,12 +168,12 @@ void TIM2_IRQHandler(void)
void TIM6_DAC_IRQHandler(void)
{
/* USER CODE BEGIN TIM6_DAC_IRQn 0 */
#if LED_MODE == 2
if(LL_TIM_IsActiveFlag_UPDATE(TIM6)){
LL_TIM_ClearFlag_UPDATE(TIM6);
#if LED_MODE == 2
LED_Handler();
}
#endif
}
/* USER CODE END TIM6_DAC_IRQn 0 */
/* USER CODE BEGIN TIM6_DAC_IRQn 1 */