Stima V4 Slave RAIN
4.2
config.h
Go to the documentation of this file.
1
3
/*********************************************************************
4
<h2><center>© Stimav4 is Copyright (C) 2023 ARPAE-SIMC urpsim@arpae.it</center></h2>
5
authors:
6
Marco Baldinetti <marco.baldinetti@digiteco.it>
7
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License
10
as published by the Free Software Foundation; either version 2
11
of the License, or (at your option) any later version.
12
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
<http://www.gnu.org/licenses/>.
22
**********************************************************************/
23
24
#ifndef _CONFIG_H
25
#define _CONFIG_H
26
27
#include "
sensors_config.h
"
28
#include "stima_config.h"
29
30
/*********************************************************************
31
* MODULE
32
*********************************************************************/
34
#define MODULE_MAIN_VERSION (4)
35
37
#define MODULE_MINOR_VERSION (3)
38
40
#define RMAP_PROCOTOL_VERSION (1)
41
42
// Random generator value for Local Test
43
// #define USE_SIMULATOR
44
45
// Fill buffer data wuith 900 data value init
46
// #define INIT_SIMULATOR
47
52
#if (USE_MODULE_THR)
53
#define MODULE_TYPE (STIMA_MODULE_TYPE_THR)
54
#elif (USE_MODULE_TH)
55
#define MODULE_TYPE (STIMA_MODULE_TYPE_TH)
56
#elif (USE_MODULE_RAIN)
57
#define MODULE_TYPE (STIMA_MODULE_TYPE_RAIN)
58
#endif
59
61
#define DEBUG_MODE (false)
62
#define ERROR_HANDLER_CB (false)
63
64
/*********************************************************************
65
* HW DEVICES
66
*********************************************************************/
67
69
#define ENABLE_I2C1 (true)
71
#define ENABLE_I2C2 (true)
73
#define ENABLE_QSPI (true)
75
#define ENABLE_CAN (true)
77
#define ENABLE_ACCELEROMETER (true)
78
80
#define ENABLE_DIAG_PIN (false)
81
82
// Enable (Wdt Task and Module) and relative Function (Stack, Info ecc...)
84
#define ENABLE_WDT (true)
86
#define WDT_TIMEOUT_BASE_US (8000000)
88
#define WDT_STARTING_TASK_MS (60000)
90
#define WDT_CONTROLLER_MS (2000)
92
#define ENABLE_STACK_USAGE (true)
94
#define UNUSED_SUB_POSITION (0)
96
#define NORMAL_STATE (0)
98
#define SLEEP_STATE (1)
100
#define SUSPEND_STATE (2)
101
102
/*********************************************************************
103
* Generic Semaphore Time acquire RTC
104
*********************************************************************/
106
#define ENABLE_RTC (true)
108
#define RTC_WAIT_DELAY_MS (100)
109
110
/*********************************************************************
111
* Address EEProm for reserved bootloader flag param (and future used 2000 Bytes)
112
*********************************************************************/
114
#define START_EEPROM_ADDRESS (0)
116
#define SIZE_EEPROM_RESERVED (450)
118
#define BOOT_LOADER_STRUCT_ADDR (START_EEPROM_ADDRESS)
120
#define BOOT_LOADER_STRUCT_SIZE (sizeof(bootloader_t))
122
#define BOOT_LOADER_STRUCT_END (START_EEPROM_ADDRESS + BOOT_LOADER_STRUCT_SIZE)
123
124
/*********************************************************************
125
* Private configuration board direct
126
*********************************************************************/
128
#define CONFIGURATION_EEPROM_ADDRESS (20)
130
#define REGISTER_EEPROM_ADDRESS (START_EEPROM_ADDRESS + SIZE_EEPROM_RESERVED)
131
133
#define SERIAL_DEBUG_BAUD_RATE (115200)
134
135
// HW I2C Speed BUS and specific config
136
#if (ENABLE_I2C1 || ENABLE_I2C2)
137
#define I2C_MAX_DATA_LENGTH (32)
138
#define I2C_MAX_ERROR_COUNT (3)
139
#endif
140
141
#if (ENABLE_I2C1)
142
#define I2C1_BUS_CLOCK_HZ (100000L)
143
#endif
144
#if (ENABLE_I2C2)
145
#define I2C2_BUS_CLOCK_HZ (100000L)
146
#endif
147
148
/*********************************************************************
149
* Queue Lenght
150
*********************************************************************/
152
#define SYSTEM_MESSAGE_QUEUE_LENGTH (4)
154
#define ELABORATE_DATA_QUEUE_LENGTH (6)
156
#define REQUEST_DATA_QUEUE_LENGTH (1)
158
#define REPORT_DATA_QUEUE_LENGTH (1)
160
#define RAIN_QUEUE_LENGTH (1)
161
162
/*********************************************************************
163
* Task system_status and queue ID message
164
*********************************************************************/
166
#define ALL_TASK_ID (99)
168
#define SUPERVISOR_TASK_ID (0)
170
#define CAN_TASK_ID (1)
172
#define ELABORATE_TASK_ID (2)
174
#define SENSOR_TASK_ID (3)
176
#define ACCELEROMETER_TASK_ID (4)
178
#define WDT_TASK_ID (5)
180
#define TOTAL_INFO_TASK (WDT_TASK_ID + 1)
181
182
/*********************************************************************
183
* Global queue wait and other timeout
184
*********************************************************************/
186
#define WAIT_QUEUE_REQUEST_PUSHDATA_MS (500)
188
#define WAIT_QUEUE_REQUEST_COMMAND_MS (500)
190
#define WAIT_QUEUE_REQUEST_RESET_TIP_MS (2000)
191
193
#define RAIN_TIPPING_DELAY_MS (100)
195
#define RAIN_TIPPING_INIBITH_DELAY_MS (500)
196
198
#define RAIN_TIPS_FOR_EVENT (2)
199
200
/*********************************************************************
201
* Specific parameter of sensor
202
*********************************************************************/
204
#define USE_TIPPING_BUCKET_REDUNDANT (true)
206
#define USE_CLOGGED_UP_CONTROL (true)
// Use clogged UP system control (verify and alert)
208
#define USE_TIPPING_CONTROL (false)
209
211
#define TIPPING_EVENT_VALUE HIGH
213
#define TIPPING_BUCKET_PIN PIN_IN0
215
#define TIPPING_BUCKET_PIN_REDUNDANT PIN_IN1
217
#define CLOGGED_UP_PIN PIN_IN2
219
#define CLOGGED_EVENT_VALUE LOW
220
221
/*********************************************************************
222
* Parameter of buffer data dimension and acquire
223
*********************************************************************/
225
#define SAMPLES_COUNT_MAX (3600)
227
#define OBSERVATIONS_TIME_S (60)
229
#define REPORTS_TIME_S (900)
230
231
/*********************************************************************
232
* Parameter of sensor and elaboration function
233
*********************************************************************/
234
// TPR Elaboration scrolling data timings
236
#define USE_MOBILE_TPR_60_S_AVG_MODE (false)
238
#define REPORT_INVALID_ACQUIRE_MIN_MS (3000)
240
#define SAMPLES_ACQUIRE_MS (10000)
242
#define SAMPLES_NEED_TPR_60_S (60000 / SAMPLES_ACQUIRE_MS)
244
#define SAMPLES_NEED_TPR_05_M (300000 / SAMPLES_ACQUIRE_MS)
245
246
// Index Sensor
247
#define RAIN_TIPS_INDEX (0)
248
#define RAIN_RAIN_INDEX (1)
249
#define RAIN_FULL_INDEX (2)
250
#define RAIN_TIPS_RESET (3)
251
#define RAIN_SCROLL_INDEX (4)
252
#define RAIN_SCROLL_RESET (5)
253
255
#define MAX_VALID_RAIN (1000.0)
257
#define MIN_VALID_RAIN (0.0)
259
#define RAIN_RATE_MULTIPLY (1000)
260
262
#define SAMPLE_ERROR_PERCENTAGE_MIN (90.0)
264
#define OBSERVATION_ERROR_PERCENTAGE_MIN (90.0)
265
266
#endif
sensors_config.h
platformio
stima_v4
slave-rain
include
config.h
Generated by
1.9.1