Compare commits

..

5 Commits

8 changed files with 57 additions and 33 deletions

@ -26,19 +26,20 @@ 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
-DNO_MODE_FLASH
build_type = debug ;build_type = debug
board_build.filesystem = littlefs board_build.filesystem = littlefs

@ -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
@ -29,7 +27,7 @@
#endif #endif
#define SW_VERSION_MAJOR 1 #define SW_VERSION_MAJOR 1
#define SW_VERSION_MINOR 0 #define SW_VERSION_MINOR 1
#ifndef OTA_DELAY #ifndef OTA_DELAY
#define OTA_DELAY 50 // ticks -> 10ms / tick #define OTA_DELAY 50 // ticks -> 10ms / tick
@ -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

@ -4,7 +4,7 @@ I2C_eeprom ee(0x50, EEPROM_SIZE_BYTES);
LubeConfig_t LubeConfig; LubeConfig_t LubeConfig;
persistenceData_t PersistenceData; persistenceData_t PersistenceData;
const uint16_t eeVersion = 1; // inc const uint16_t eeVersion = 2; // inc
boolean eeAvailable = false; boolean eeAvailable = false;
const uint16_t startofLubeConfig = 16; const uint16_t startofLubeConfig = 16;
@ -17,8 +17,6 @@ void InitEEPROM()
ee.begin(); ee.begin();
if (!checkEEPROMavailable()) if (!checkEEPROMavailable())
{ {
globals.systemStatus = sysStat_Error;
MaintainDTC(DTC_NO_EEPROM_FOUND, true);
return; return;
} }
GetConfig_EEPROM(); GetConfig_EEPROM();
@ -227,7 +225,9 @@ boolean checkEEPROMavailable()
if (!ee.isConnected()) if (!ee.isConnected())
{ {
MaintainDTC(DTC_NO_EEPROM_FOUND, true); MaintainDTC(DTC_NO_EEPROM_FOUND, true);
globals.systemStatus = sysStat_Error;
return false; return false;
} }
MaintainDTC(DTC_NO_EEPROM_FOUND, false);
return true; return true;
} }

@ -83,7 +83,7 @@ typedef struct
uint32_t TireWidthHeight_Ratio = 70; uint32_t TireWidthHeight_Ratio = 70;
uint32_t RimDiameter_Inch = 18; uint32_t RimDiameter_Inch = 18;
uint32_t DistancePerRevolution_mm = 2000; uint32_t DistancePerRevolution_mm = 2000;
uint8_t BleedingPulses = 25; uint16_t BleedingPulses = 25;
SpeedSource_t SpeedSource = SOURCE_IMPULSE; SpeedSource_t SpeedSource = SOURCE_IMPULSE;
#ifdef FEATURE_ENABLE_GPS #ifdef FEATURE_ENABLE_GPS
GPSBaudRate_t GPSBaudRate = BAUD_115200; GPSBaudRate_t GPSBaudRate = BAUD_115200;

@ -28,7 +28,7 @@ typedef struct Globals_s
tSystem_Status systemStatus = sysStat_Startup; tSystem_Status systemStatus = sysStat_Startup;
tSystem_Status resumeStatus = sysStat_Startup; tSystem_Status resumeStatus = sysStat_Startup;
char systemStatustxt[16] = ""; char systemStatustxt[16] = "";
uint8_t purgePulses = 0; uint16_t purgePulses = 0;
eEERequest requestEEAction = EE_IDLE; eEERequest requestEEAction = EE_IDLE;
char DeviceName[33]; char DeviceName[33];
uint32_t FlashVersion; uint32_t FlashVersion;

@ -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;
@ -504,7 +504,7 @@ void LED_Process(uint8_t override, CRGB SetColor)
oldSysStatus = globals.systemStatus; oldSysStatus = globals.systemStatus;
} }
uint32_t percentage = PersistenceData.tankRemain_µl / (LubeConfig.tankCapacity_ml * 10); uint32_t percentage = PersistenceData.tankRemain_µl / (LubeConfig.tankCapacity_ml * 1000);
switch (LED_Status) switch (LED_Status)
{ {
@ -529,9 +529,13 @@ void LED_Process(uint8_t override, CRGB SetColor)
break; break;
case LED_Normal: case LED_Normal:
#ifndef NO_MODE_FLASH
if (timer % 2000 > 1950) if (timer % 2000 > 1950)
leds[0] = CRGB(0, 255, 0); leds[0] = CRGB(0, 255, 0);
else if (WiFi.getMode() != WIFI_OFF && timer % 2000 > 1800 && timer % 2000 < 1850) else if (WiFi.getMode() != WIFI_OFF && timer % 2000 > 1800 && timer % 2000 < 1850)
#else
if (WiFi.getMode() != WIFI_OFF && timer % 2000 > 1950)
#endif
leds[0] = CRGB(255, 128, 0); leds[0] = CRGB(255, 128, 0);
else else
leds[0] = CRGB(0, 4, 0); leds[0] = CRGB(0, 4, 0);
@ -549,9 +553,13 @@ void LED_Process(uint8_t override, CRGB SetColor)
break; break;
case LED_Rain: case LED_Rain:
#ifndef NO_MODE_FLASH
if (timer % 2000 > 1950) if (timer % 2000 > 1950)
leds[0] = CRGB(0, 0, 255); leds[0] = CRGB(0, 0, 255);
else if (WiFi.getMode() != WIFI_OFF && timer % 2000 > 1800 && timer % 2000 < 1850) else if (WiFi.getMode() != WIFI_OFF && timer % 2000 > 1800 && timer % 2000 < 1850)
#else
if (WiFi.getMode() != WIFI_OFF && timer % 2000 > 1950)
#endif
leds[0] = CRGB(255, 128, 0); leds[0] = CRGB(255, 128, 0);
else else
leds[0] = CRGB(0, 0, 4); leds[0] = CRGB(0, 0, 4);

@ -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_

@ -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