STIMA  3
stimawifi_config.h
1 #ifndef STIMAWIFI_CONFIG_H_
2 #define STIMAWIFI_CONFIG_H_
3 
4 // increment on change
5 #define SOFTWARE_VERSION "2024-10-31T00:00" // date and time
6 #define MAJOR_VERSION "20241031" // date YYYYMMDD
7 #define MINOR_VERSION "0" // time HHMM without leading 0
8 
9 // SSID and password of WiFi for setup
10 #define WIFI_SSED "STIMA-config"
11 #define WIFI_PASSWORD "bellastima"
12 
13 // defaul sample time to get measure from sensors
14 #define DEFAULT_SAMPLETIME 30
15 
16 // udp port to use for communicate with androd gps_forwarder app
17 #define UDP_PORT 8888
18 
19 // display I2C address
20 #define OLEDI2CADDRESS 0X3C
21 
22 // logging level at compile time
23 // Available levels are:
24 // LOG_LEVEL_SILENT, LOG_LEVEL_FATAL, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, LOG_LEVEL_NOTICE, LOG_LEVEL_VERBOSE
25 #define LOG_LEVEL LOG_LEVEL_NOTICE
26 
27 // Length of datetime string %04u-%02u-%02uT%02u:%02u:%02u
28 #define DATE_TIME_STRING_LENGTH (25)
29 
30 // minimum heap size for warning
31 #define HEAP_MIN_WARNING 5000
32 
33 // minimum thread stack size for warning
34 #define STACK_MIN_WARNING 100
35 
36 // port for http server
37 #define STIMAHTTP_PORT 80
38 
39 #define FIRMWARE_TYPE "LOLIN_C3_MINI"
40 
41 // set to 1 if we use PMS sensor
42 #define PMS_RESET 0
43 
44 // define pins for I2C
45 #define SCL_PIN SCL
46 #define SDA_PIN SDA
47 
48 // define reset and LED pins
49 #if defined(ARDUINO_LOLIN_C3_MINI)
50 //C3 mini
51 // https://www.wemos.cc/en/latest/_static/files/sch_c3_mini_v2.1.0.pdf
52 // pin to connect to ground for reset wifi configuration
53 #define RESET_PIN 4
54 #define LED_PIN 7
55 #endif
56 
57 #if defined(ARDUINO_LOLIN_S3_MINI)
58 //S3 mini
59 // https://www.wemos.cc/en/latest/_static/files/sch_s3_mini_v1.0.0.pdf
60 #define RESET_PIN 11
61 #define LED_PIN 47
62 #endif
63 
64 #if defined(ARDUINO_D1_MINI32)
65 // D1 mini ESP32
66 // https://cdn.shopify.com/s/files/1/1509/1638/files/D1_Mini_ESP32_-_pinout.pdf?v=1604068668
67 #define RESET_PIN 23
68 #define LED_PIN 34 // not connected to neopixel
69 #endif
70 
71 // size for sensor_t
72 #define SENSORDRIVER_DRIVER_LEN 5
73 #define SENSORDRIVER_TYPE_LEN 5
74 #define SENSORDRIVER_META_LEN 30
75 
76 // character height px for display
77 #define CH 8
78 
79 // define parameter for queues len and communication
80 //#define DATA_BURST (SENSORS_MAX*VALUES_TO_READ_FROM_SENSOR_COUNT)
81 #define DATA_BURST (15)
82 #define DATA_BURST_RECOVERY (DATA_BURST)
83 
84 #define DB_QUEUE_LEN (DATA_BURST)
85 #define MQTT_QUEUE_LEN (DATA_BURST*3)
86 
87 #define MQTT_QUEUE_SPACELEFT_MEASURE (DATA_BURST)
88 #define MQTT_QUEUE_SPACELEFT_PUBLISH (DATA_BURST/2)
89 #define MQTT_QUEUE_SPACELEFT_RECOVERY (DATA_BURST*2)
90 
91 // SD card SPI PIN assignment
92 // Micro SD Card Shield
93 #define C3SCK 1
94 #define C3MISO 0
95 #define C3MOSI 4
96 
97 //https://www.wemos.cc/en/latest/d1_mini_shield/micro_sd.html
98 #define C3SS 6
99 
100 //WIFI D1 mini - Data logger shield for D1 mini with RTC and MicroSD
101 //https://en.m.nu/esp8266-shields/wifi-d1-mini-data-logger-shield-for-d1-mini-with-rtc-and-microsd
102 //#define C3SS 5
103 
104 // SPI clock
105 #define SPICLOCK 10000000
106 
107 // SD card max number of file opened
108 #define SDMAXFILE 6
109 
110 // SD card file name for archive
111 #define SDCARD_INFO_FILE_NAME ("/info.dat")
112 #define SDCARD_ARCHIVE_FILE_NAME ("/archive.dat")
113 
114 // littlefs max number of file opened on EEPROM
115 #define LFMAXFILE 4
116 
117 // time in seconds saved on sqlite on SD card for tmp archive and recovery
118 #define SDRECOVERYTIME (3600*24*1)
119 
120 // sqlite setup
121 /*
122  https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/memory-types.html
123  There is 520 KB of available SRAM (320 KB of DRAM and 200 KB of
124  IRAM) on the ESP32. However, due to a technical limitation, the
125  maximum statically allocated DRAM usage is 160 KB. The remaining 160
126  KB (for a total of 320 KB of DRAM) can only be allocated at runtime
127  as heap.
128 */
129 #define SQLITE_MEMORY 110000
130 
135 #define MQTT_TIMEOUT_MS (6000)
136 
141 #define IP_STACK_TIMEOUT_MS (MQTT_TIMEOUT_MS)
142 
147 #define MQTT_PACKET_SIZE (220)
148 
149 // MQTT broker port
150 # define MQTT_SERVER_PORT (1883)
151 
156 #define CONSTANTDATA_BTABLE_LENGTH (7)
157 
162 #define CONSTANTDATA_VALUE_LENGTH (33)
163 
164 
165 #endif