annotate Small_CPU/Inc/scheduler.h @ 135:5df4f1a315cb FlipDisplay

Restore old data copy locations Do first calculation based on ambient bar to avoid desaturation shift Added error handling for lost communication
author Ideenmodellierer
date Tue, 19 Feb 2019 18:18:37 +0100
parents 3db7389d49cc
children 6b83ca1225de
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 * @file scheduler.h
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 * @author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 * @version V0.0.5
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 * @date 27-March-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 * @brief
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 * @attention
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 * <h2><center>&copy; COPYRIGHT(c) 2015 heinrichs weikamp</center></h2>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 *
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 #ifndef SCHEDULER_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 #define SCHEDULER_H
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 extern "C" {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 #include "data_central.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28 #include "data_exchange.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 #include "settings.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 /* Types -------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #define MAX_WIRELESS_BYTES 10
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 #define SENSOR_PRESSURE_ID 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #define MAX_SENSORS 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 uint8_t mode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 short conservatism;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 short repetitive_dive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 long seconds_since_last_dive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 long no_fly_time_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 uint8_t whichGas;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44 SGas aktualGas[2];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 float ceiling_from_main_CPU_mbar;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 SLifeData lifeData;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 SVpm vpm;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48 SSettings settings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 SDevice deviceData;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50 SDataExchangeSlaveToMasterDeviceData deviceDataSendToMaster;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 SDataExchangeSlaveToMaster dataSendToMaster;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 SDataReceiveFromMaster dataSendToSlave;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53 _Bool demo_mode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 uint8_t dataSendToSlaveIsValid;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 uint8_t dataSendToSlavePending;
88
Dmitry Romanov <kitt@bk.ru>
parents: 84
diff changeset
56 uint8_t dataSendToSlaveStopEval;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57 uint32_t sync_error_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 uint32_t check_sync_not_running;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 uint8_t ButtonResponsiveness[4];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 uint8_t chargerStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 uint8_t dataSendToSlaveIsNotValidCount;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 uint8_t wirelessdata[MAX_WIRELESS_BYTES];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 uint8_t wirelessReceived;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 uint8_t wirelessConfidenceStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 uint8_t ButtonPICdata[4];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 uint8_t accidentFlag;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 uint32_t accidentRemainingSeconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 uint8_t sensorError[MAX_SENSORS];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 uint8_t I2C_SystemStatus;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 } SGlobal;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 typedef struct
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 long seconds_since_last_dive;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 long no_fly_time_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 } SBackup;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78 /* Variables ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 extern SGlobal global;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 /* Function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 void initGlobals(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 void scheduleSurfaceMode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 void scheduleDiveMode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 void scheduleSleepMode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 void scheduleCompassCalibrationMode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90 void scheduleTestMode(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 void scheduleUpdateLifeData(int32_t asynchron_milliseconds_since_last);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 void scheduleSpecial_Evaluate_DataSendToSlave(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 void scheduleUpdateDeviceDataChargerFull(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 void scheduleUpdateDeviceDataChargerCharging(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 uint8_t scheduleSetButtonResponsiveness(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 void copyBatteryData(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 //void scheduleSurfaceMode_test(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 //void scheduleSleepMode_test(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 #ifdef __cplusplus
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108 #endif /* SCHEDULER_H */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/