start of sanitycheck-header

This commit is contained in:
Marcel Peterkau 2022-08-21 11:28:58 +02:00
parent a6f5b4ef65
commit 4ce550c668
5 changed files with 41 additions and 26 deletions

View File

@ -26,19 +26,19 @@ upload_speed = 921600
build_flags = build_flags =
!python git_rev_macro.py !python git_rev_macro.py
-DWIFI_SSID=${wifi_cred.wifi_ssid} -DWIFI_SSID_CLIENT=${wifi_cred.wifi_ssid_client}
-DWIFI_PASSWORD=${wifi_cred.wifi_password} -DWIFI_PASSWORD_CLIENT=${wifi_cred.wifi_password_client}
-DADMIN_PASSWORD=${wifi_cred.admin_password} -DADMIN_PASSWORD=${wifi_cred.admin_password}
-DWIFI_AP_PASSWORD=${wifi_cred.wifi_ap_password} -DWIFI_AP_PASSWORD=${wifi_cred.wifi_ap_password}
-DWIFI_AP_IP_GW=10,0,0,1 -DWIFI_AP_IP_GW=10,0,0,1
-DFEATURE_ENABLE_WIFI_CLIENT ;-DFEATURE_ENABLE_WIFI_CLIENT
-DFEATURE_ENABLE_REMOTE_DEBUG ;-DFEATURE_ENABLE_REMOTE_DEBUG
;-DFEATURE_ENABLE_OLED ;-DFEATURE_ENABLE_OLED
;-DFEATURE_ENABLE_CAN ;-DFEATURE_ENABLE_CAN
;-DFEATURE_ENABLE_GPS ;-DFEATURE_ENABLE_GPS
-DPCB_REV=2 -DPCB_REV=2
build_type = debug ;build_type = debug
board_build.filesystem = littlefs board_build.filesystem = littlefs

View File

@ -4,9 +4,7 @@
#define Q(x) #x #define Q(x) #x
#define QUOTE(x) Q(x) #define QUOTE(x) Q(x)
#ifndef PCB_REV #if PCB_REV == 2
#error "You must define PCB_REV"
#elif PCB_REV == 2
#define GPIO_BUTTON D7 #define GPIO_BUTTON D7
#define GPIO_LED D8 #define GPIO_LED D8
#define GPIO_TRIGGER D6 #define GPIO_TRIGGER D6
@ -16,7 +14,7 @@
#define GPIO_LED D6 #define GPIO_LED D6
#define GPIO_TRIGGER D4 #define GPIO_TRIGGER D4
#define GPIO_PUMP D3 #define GPIO_PUMP D3
#elif PCB_REV >= 4 #elif PCB_REV == 4
#define GPIO_BUTTON D4 #define GPIO_BUTTON D4
#define GPIO_LED D3 #define GPIO_LED D3
#define GPIO_TRIGGER D6 #define GPIO_TRIGGER D6
@ -39,17 +37,4 @@
#define ATOMIC_FS_UPDATE #define ATOMIC_FS_UPDATE
#ifndef ADMIN_PASSWORD
#error "You need to define ADMIN_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_PASSWORD
#error "You must define an WIFI_PASSWORD for OTA-Update"
#endif
#ifndef WIFI_SSID
#error "You must define an WIFI_SSID for OTA-Update"
#endif
#ifndef WIFI_AP_PASSWORD
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
#endif
#endif #endif

View File

@ -34,8 +34,8 @@
#ifdef FEATURE_ENABLE_WIFI_CLIENT #ifdef FEATURE_ENABLE_WIFI_CLIENT
#include <ESP8266WiFiMulti.h> #include <ESP8266WiFiMulti.h>
const char *ssid = QUOTE(WIFI_SSID); const char *ssid = QUOTE(WIFI_SSID_CLIENT);
const char *password = QUOTE(WIFI_PASSWORD); const char *password = QUOTE(WIFI_PASSWORD_CLIENT);
const uint32_t connectTimeoutMs = 5000; const uint32_t connectTimeoutMs = 5000;
ESP8266WiFiMulti wifiMulti; ESP8266WiFiMulti wifiMulti;

View File

@ -0,0 +1,30 @@
#ifndef _SANITYCHECK_H_
#define _SANITYCHECK_H_
#ifndef PCB_REV
#error "You must define PCB_REV"
#else
#if PCB_REV < 1 || PCB_REV > 4
#error "Unsupported PCB-Revision"
#endif
#endif
#ifndef ADMIN_PASSWORD
#error "You need to define ADMIN_PASSWORD for OTA-Update"
#endif
#ifdef FEATURE_ENABLE_WIFI_CLIENT
#ifndef WIFI_PASSWORD_CLIENT
#error "You must define an WIFI_PASSWORD for Client-Mode"
#endif
#ifndef WIFI_SSID_CLIENT
#error "You must define an WIFI_SSID for Client-Mode"
#endif
#endif
#ifndef WIFI_AP_PASSWORD
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
#endif
#endif //_SANITYCHECK_H_

View File

@ -1,5 +1,5 @@
[wifi_cred] [wifi_cred]
admin_password = adminpass admin_password = adminpass
wifi_ap_password = wifiappass wifi_ap_password = wifiappass
wifi_ssid = wifi-ssid wifi_ssid_client = wifi-ssid
wifi_password = wifi-pass wifi_password_client = wifi-pass