Go to the documentation of this file.
23 #ifndef _STIMA_CONFIG_H
24 #define _STIMA_CONFIG_H
28 #include <stima_module.h>
37 #define MODULE_MAIN_VERSION (3)
43 #define MODULE_MINOR_VERSION (11)
49 #define MODULE_CONFIGURATION_VERSION (2)
56 #define MODULE_TYPE (STIMA_MODULE_TYPE_REPORT_GSM)
58 #if (MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE)
63 #define USE_MQTT (false)
69 #define USE_MQTT (true)
76 #define USE_LCD (true)
82 #define USE_SDCARD (false | USE_MQTT)
84 #if (MODULE_TYPE != STIMA_MODULE_TYPE_PASSIVE)
89 #define USE_NTP (true)
96 #define USE_RTC (true)
102 #define USE_TIMER_1 (!USE_RTC)
108 #define USE_RPC_METHOD_CONFIGURE (true)
114 #define USE_RPC_METHOD_PREPARE (false)
120 #define USE_RPC_METHOD_PREPANDGET (false)
126 #define USE_RPC_METHOD_GETJSON (false)
132 #define USE_RPC_METHOD_REBOOT (true)
139 #define USE_RPC_METHOD_RECOVERY (true)
148 #define CONFIGURATION_DEFAULT_TH_ADDRESS (I2C_TH_DEFAULT_ADDRESS)
154 #define CONFIGURATION_DEFAULT_RAIN_ADDRESS (I2C_RAIN_DEFAULT_ADDRESS)
160 #define CONFIGURATION_RESET_PIN (8)
166 #define CONFIGURATION_DEFAULT_NTP_SERVER (NTP_DEFAULT_SERVER)
173 #define CONFIGURATION_DEFAULT_MQTT_PORT (MQTT_DEFAULT_PORT)
179 #define CONFIGURATION_DEFAULT_MQTT_SERVER (MQTT_DEFAULT_SERVER)
185 #define CONFIGURATION_DEFAULT_MQTT_ROOT_TOPIC (MQTT_DEFAULT_ROOT_TOPIC)
191 #define CONFIGURATION_DEFAULT_MQTT_MAINT_TOPIC (MQTT_DEFAULT_MAINT_TOPIC)
197 #define CONFIGURATION_DEFAULT_MQTT_RPC_TOPIC (MQTT_DEFAULT_RPC_TOPIC)
203 #define CONFIGURATION_DEFAULT_MQTT_USERNAME (MQTT_DEFAULT_USERNAME)
209 #define CONFIGURATION_DEFAULT_MQTT_PASSWORD (MQTT_DEFAULT_PASSWORD)
215 #define CONFIGURATION_DEFAULT_STATIONSLUG (DEFAULT_STATIONSLUG)
221 #define CONFIGURATION_DEFAULT_BOARDSLUG (DEFAULT_BOARDSLUG)
225 #if (MODULE_TYPE == STIMA_MODULE_TYPE_SAMPLE_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_REPORT_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_ETH)
230 #define CONFIGURATION_DEFAULT_ETHERNET_DHCP_ENABLE (ETHERNET_DEFAULT_DHCP_ENABLE)
236 #define CONFIGURATION_DEFAULT_ETHERNET_MAC (ETHERNET_DEFAULT_MAC)
242 #define CONFIGURATION_DEFAULT_ETHERNET_IP (ETHERNET_DEFAULT_IP)
248 #define CONFIGURATION_DEFAULT_ETHERNET_NETMASK (ETHERNET_DEFAULT_NETMASK)
254 #define CONFIGURATION_DEFAULT_ETHERNET_GATEWAY (ETHERNET_DEFAULT_GATEWAY)
260 #define CONFIGURATION_DEFAULT_ETHERNET_PRIMARY_DNS (ETHERNET_DEFAULT_PRIMARY_DNS)
262 #elif (MODULE_TYPE == STIMA_MODULE_TYPE_SAMPLE_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_REPORT_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_GSM)
267 #define CONFIGURATION_DEFAULT_GSM_APN (GSM_DEFAULT_APN)
273 #define CONFIGURATION_DEFAULT_GSM_USERNAME (GSM_DEFAULT_USERNAME)
279 #define CONFIGURATION_DEFAULT_GSM_PASSWORD (GSM_DEFAULT_PASSWORD)
291 #define SENSOR_ERROR_COUNT_MAX (20)
296 #if (MODULE_TYPE == STIMA_MODULE_TYPE_SAMPLE_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_REPORT_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_ETH)
301 #define USE_POWER_DOWN (false)
303 #elif (MODULE_TYPE == STIMA_MODULE_TYPE_SAMPLE_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_REPORT_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE)
308 #define USE_POWER_DOWN (true)
316 #define DEBOUNCING_POWER_DOWN_TIME_MS (10)
318 #if (MODULE_TYPE == STIMA_MODULE_TYPE_SAMPLE_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_REPORT_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_ETH)
323 #define W5500_CHIP_SELECT_PIN (10)
325 #elif (MODULE_TYPE == STIMA_MODULE_TYPE_SAMPLE_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_REPORT_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_GSM)
330 #define GSM_ON_OFF_PIN (SIM800_ON_OFF_PIN)
337 #define GSM_RESET_PIN (SIM800_RESET_PIN)
347 #define SDCARD_CHIP_SELECT_PIN (7)
353 #define SDCARD_INFO_FILE_NAME ("info.dat")
359 #define SDCARD_LOGGING_FILE_NAME ("stima.log")
365 #define SDCARD_CONFIG_FILE_NAME ("config.cfg")
371 #define SDCARD_CONFIG_SAVED_FILE_NAME ("config.sav")
386 #ifdef ARDUINO_ARCH_AVR
387 #define WDT_TIMER (WDTO_8S)
389 #define WDT_TIMER (8)
399 #define RTC_FREQUENCY (PCF8563_CLKOUT_FREQUENCY_SECONDS)
405 #define RTC_INTERRUPT_PIN (6)
414 #define TIMER1_INTERRUPT_TIME_MS (1000)
420 #define TIMER1_TCNT1_VALUE (0xFFFFUL - (TIMER1_INTERRUPT_TIME_MS*1000UL/(1024 / (F_CPU/1000000)))+1)
430 #define USE_CONSTANTDATA_COUNT (3)
439 #define SENSORS_RETRY_COUNT_MAX (3)
445 #define SENSORS_RETRY_DELAY_MS (50)
451 #define SENSORS_TESTING_DELAY_S (60)
457 #define DATA_PROCESSING_RETRY_COUNT_MAX (2)
463 #define DATA_PROCESSING_RETRY_DELAY_MS (500)
469 #define DATA_SAVING_RETRY_COUNT_MAX (2)
475 #define DATA_SAVING_DELAY_MS (100)
481 #define MQTT_RETRY_COUNT_MAX (3)
487 #define MQTT_DELAY_MS (3000)
493 #define IP_STACK_TIMEOUT_MS (MQTT_TIMEOUT_MS)
499 #define SUPERVISOR_CONNECTION_RETRY_COUNT_MAX (3)
505 #define SUPERVISOR_CONNECTION_TIMEOUT_MS (120000)
512 #define SDCARD_MQTT_PTR_FILE_NAME ("mqtt_ptr.txt")
519 #define SDCARD_MQTT_PTR_RPC_FILE_NAME ("rpc_ptr.txt")
527 #define NTP_RETRY_COUNT_MAX (5)
533 #define NTP_RETRY_DELAY_MS (1000)
539 #define NTP_TIME_FOR_RESYNC_S (SECS_PER_DAY)
541 #define NTP_MAX_DIFF_VALID_TIME_S (SECS_PER_DAY)
547 #define LCD_TIME_FOR_REINITIALIZE_S (SECS_PER_DAY)
553 #define DISPLAY_SET_MAX (2)
555 #if (MODULE_TYPE == STIMA_MODULE_TYPE_SAMPLE_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_REPORT_ETH || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_ETH)
560 #define ETHERNET_RETRY_COUNT_MAX (5)
566 #define ETHERNET_RETRY_DELAY_MS (ETHERNET_ATTEMPT_MS)
568 #elif (MODULE_TYPE == STIMA_MODULE_TYPE_SAMPLE_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_REPORT_GSM || MODULE_TYPE == STIMA_MODULE_TYPE_PASSIVE_GSM)
575 #define DATE_TIME_STRING_LENGTH (25)