comparison Small_CPU/Src/scheduler.c @ 899:2225c467f1e9 Evo_2_23 tip

Added data path and visualization for position data: The GNSS data exchange is now initialized and triggered on a cyclic basis (once a second). RTE verion has been increased because of interface change. For now only the position data is shown in a T7 surface views. The functionality may be switched on/off using the compile switch ENABLE_GNSS.
author Ideenmodellierer
date Mon, 30 Sep 2024 21:56:05 +0200
parents 5b675077ccfb
children
comparison
equal deleted inserted replaced
898:fac13aa6ba93 899:2225c467f1e9
41 #include "stm32f4xx_hal_rtc_ex.h" 41 #include "stm32f4xx_hal_rtc_ex.h"
42 #include "decom.h" 42 #include "decom.h"
43 #include "tm_stm32f4_otp.h" 43 #include "tm_stm32f4_otp.h"
44 #include "externalInterface.h" 44 #include "externalInterface.h"
45 #include "uart.h" 45 #include "uart.h"
46 #include "GNSS.h"
47 #include "uartProtocol_GNSS.h"
46 #include "math.h" 48 #include "math.h"
49 #include "configuration.h"
47 50
48 /* uncomment to enable restoting of last known date in case of a power loss (RTC looses timing data) */ 51 /* uncomment to enable restoting of last known date in case of a power loss (RTC looses timing data) */
49 /* #define RESTORE_LAST_KNOWN_DATE */ 52 /* #define RESTORE_LAST_KNOWN_DATE */
50 53
51 #define INVALID_PREASURE_VALUE (0.0f) 54 #define INVALID_PREASURE_VALUE (0.0f)
99 void copyVpmCrushingData(void); 102 void copyVpmCrushingData(void);
100 void copyDeviceData(void); 103 void copyDeviceData(void);
101 void copyPICdata(void); 104 void copyPICdata(void);
102 void copyExtADCdata(); 105 void copyExtADCdata();
103 void copyExtCO2data(); 106 void copyExtCO2data();
107 void copyGNSSdata(void);
104 static void schedule_update_timer_helper(int8_t thisSeconds); 108 static void schedule_update_timer_helper(int8_t thisSeconds);
105 static void evaluateAscentSpeed(void); 109 static void evaluateAscentSpeed(void);
106 uint32_t time_elapsed_ms(uint32_t ticksstart,uint32_t ticksnow); 110 uint32_t time_elapsed_ms(uint32_t ticksstart,uint32_t ticksnow);
107 111
108 void scheduleSetDate(SDeviceLine *line); 112 void scheduleSetDate(SDeviceLine *line);
872 /* evaluate compass data at 70 ms, 170 ms, 270 ms,... duration <1ms */ 876 /* evaluate compass data at 70 ms, 170 ms, 270 ms,... duration <1ms */
873 if(ticksdiff >= Scheduler.counterAmbientLight100msec * 100 + 70) 877 if(ticksdiff >= Scheduler.counterAmbientLight100msec * 100 + 70)
874 { 878 {
875 adc_ambient_light_sensor_get_data(); 879 adc_ambient_light_sensor_get_data();
876 copyAmbientLightData(); 880 copyAmbientLightData();
881 #ifdef ENABLE_GNSS
882 uartGnss_ProcessData();
883 uartGnss_Control();
884 #endif
885 copyGNSSdata();
877 Scheduler.counterAmbientLight100msec++; 886 Scheduler.counterAmbientLight100msec++;
878 } 887 }
879 888
880 889
881 890
1732 global.dataSendToMaster.data[(boolCO2Buffer && DATA_BUFFER_CO2)].externalInterface_CmdAnswer = 0; 1741 global.dataSendToMaster.data[(boolCO2Buffer && DATA_BUFFER_CO2)].externalInterface_CmdAnswer = 0;
1733 } 1742 }
1734 global.dataSendToMaster.boolADCO2Data |= boolCO2Buffer; 1743 global.dataSendToMaster.boolADCO2Data |= boolCO2Buffer;
1735 } 1744 }
1736 1745
1746 void copyGNSSdata(void)
1747 {
1748 #ifdef ENABLE_GNSS
1749 global.dataSendToMaster.data[0].fLat = GNSS_Handle.fLat;
1750 global.dataSendToMaster.data[0].fLon = GNSS_Handle.fLon;
1751 #else
1752 static float tmpLon = 0.0;
1753 static float tmpLat= 100.0;
1754 global.dataSendToMaster.data[0].fLat = tmpLat;
1755 global.dataSendToMaster.data[0].fLon = tmpLon;
1756 tmpLon += 0.15;
1757 if(tmpLon > 360.0) tmpLon = 0.0;
1758 tmpLat += 0.33;
1759 if(tmpLat > 360.0) tmpLat = 0.0;
1760 #endif
1761 }
1762
1763
1737 typedef enum 1764 typedef enum
1738 { 1765 {
1739 SPI3_OK = 0x00, 1766 SPI3_OK = 0x00,
1740 SPI3_DEINIT = 0x01, 1767 SPI3_DEINIT = 0x01,
1741 } SPI3_StatusTypeDef; 1768 } SPI3_StatusTypeDef;