Added defines for PCB_revisions
This commit is contained in:
parent
152a324c9d
commit
b029243760
@ -32,6 +32,7 @@ build_flags =
|
|||||||
-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
|
||||||
|
-DPCB_REVISION=13
|
||||||
|
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
|
|
||||||
@ -46,3 +47,5 @@ lib_deps =
|
|||||||
fastled/FastLED @ ^3.5.0
|
fastled/FastLED @ ^3.5.0
|
||||||
sstaub/Ticker @ ^4.2.0
|
sstaub/Ticker @ ^4.2.0
|
||||||
s00500/ESPUI @ ^2.0.0
|
s00500/ESPUI @ ^2.0.0
|
||||||
|
coryjfowler/mcp_can @ ^1.5.0
|
||||||
|
robtillaart/I2C_EEPROM @ ^1.5.2
|
@ -4,10 +4,11 @@
|
|||||||
#define Q(x) #x
|
#define Q(x) #x
|
||||||
#define QUOTE(x) Q(x)
|
#define QUOTE(x) Q(x)
|
||||||
|
|
||||||
#define GPIO_BUTTON D5
|
#define GPIO_BUTTON D4
|
||||||
#define GPIO_LED D6
|
#define GPIO_LED D3
|
||||||
#define GPIO_TRIGGER D4
|
#define GPIO_TRIGGER D6
|
||||||
#define GPIO_PUMP D3
|
#define GPIO_PUMP D0
|
||||||
|
#define GPIO_CS_CAN D8
|
||||||
|
|
||||||
#ifndef HOST_NAME
|
#ifndef HOST_NAME
|
||||||
#define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added
|
#define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added
|
||||||
@ -30,4 +31,16 @@
|
|||||||
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
|
#error "You must define an WIFI_AP_PASSWORD for Standalone AP-Mode"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PCB_REVISION
|
||||||
|
#error "You must define PCB_REVISION"
|
||||||
|
#else
|
||||||
|
|
||||||
|
#if PCB_REVISION == 13
|
||||||
|
#elif PCB_REVISION == 12
|
||||||
|
#elif PCB_REVISION == 10
|
||||||
|
#else
|
||||||
|
#error "Unknown PCB_REVISION defined"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,29 +1,64 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
I2C_eeprom ee(0x50, EEPROM_SIZE_BYTES);
|
||||||
|
#endif
|
||||||
|
|
||||||
LubeConfig_t LubeConfig;
|
LubeConfig_t LubeConfig;
|
||||||
persistenceData_t PersistenceData;
|
persistenceData_t PersistenceData;
|
||||||
uint16_t eePersistenceMarker = 0;
|
uint16_t eePersistenceMarker = 0;
|
||||||
uint16_t eeVersion = 0; // inc
|
uint16_t eeVersion = 0; // inc
|
||||||
|
boolean eeAvailable = false;
|
||||||
|
|
||||||
const uint16_t startofLubeConfig = sizeof(eePersistenceMarker);
|
const uint16_t startofLubeConfig = sizeof(eePersistenceMarker);
|
||||||
const uint16_t startofPersistence = sizeof(LubeConfig);
|
const uint16_t startofPersistence = sizeof(LubeConfig);
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
void InitEEPROM()
|
||||||
|
{
|
||||||
|
ee.begin();
|
||||||
|
if (ee.isConnected())
|
||||||
|
{
|
||||||
|
eeAvailable = true;
|
||||||
|
Serial.println("EEPROM Initialized...");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Serial.println("ERROR: Can't find eeprom...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void StoreConfig_EEPROM()
|
void StoreConfig_EEPROM()
|
||||||
{
|
{
|
||||||
LubeConfig.checksum = 0;
|
LubeConfig.checksum = 0;
|
||||||
LubeConfig.checksum = Checksum_EEPROM((uint8_t *)&LubeConfig, sizeof(LubeConfig));
|
LubeConfig.checksum = Checksum_EEPROM((uint8_t *)&LubeConfig, sizeof(LubeConfig));
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
if (eeAvailable)
|
||||||
|
{
|
||||||
|
ee.updateBlock(startofLubeConfig, (uint8_t *)&LubeConfig, sizeof(LubeConfig));
|
||||||
|
}
|
||||||
|
#else
|
||||||
EEPROM.begin(512);
|
EEPROM.begin(512);
|
||||||
EEPROM.put(startofLubeConfig, LubeConfig);
|
EEPROM.put(startofLubeConfig, LubeConfig);
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
EEPROM.end();
|
EEPROM.end();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetConfig_EEPROM()
|
void GetConfig_EEPROM()
|
||||||
{
|
{
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
if (eeAvailable)
|
||||||
|
{
|
||||||
|
ee.readBlock(startofLubeConfig, (uint8_t *)&LubeConfig, sizeof(LubeConfig));
|
||||||
|
}
|
||||||
|
#else
|
||||||
EEPROM.begin(512);
|
EEPROM.begin(512);
|
||||||
EEPROM.get(startofLubeConfig, LubeConfig);
|
EEPROM.get(startofLubeConfig, LubeConfig);
|
||||||
EEPROM.end();
|
EEPROM.end();
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t checksum = LubeConfig.checksum;
|
uint32_t checksum = LubeConfig.checksum;
|
||||||
LubeConfig.checksum = 0;
|
LubeConfig.checksum = 0;
|
||||||
@ -37,37 +72,52 @@ void GetConfig_EEPROM()
|
|||||||
|
|
||||||
void StorePersistence_EEPROM()
|
void StorePersistence_EEPROM()
|
||||||
{
|
{
|
||||||
EEPROM.begin(512);
|
|
||||||
|
|
||||||
if (PersistenceData.writeCycleCounter == 0xFFFF)
|
if (PersistenceData.writeCycleCounter == 0xFFFF)
|
||||||
{
|
MovePersistencePage_EEPROM(false);
|
||||||
PersistenceData.writeCycleCounter = 0;
|
|
||||||
eePersistenceMarker += sizeof(PersistenceData);
|
|
||||||
EEPROM.put(0, eePersistenceMarker);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
PersistenceData.writeCycleCounter++;
|
PersistenceData.writeCycleCounter++;
|
||||||
}
|
|
||||||
|
|
||||||
uint16_t PersistenceDataAddress = startofPersistence + eePersistenceMarker;
|
uint16_t PersistenceDataAddress = startofPersistence + eePersistenceMarker;
|
||||||
|
|
||||||
PersistenceData.checksum = 0;
|
PersistenceData.checksum = 0;
|
||||||
PersistenceData.checksum = Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData));
|
PersistenceData.checksum = Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData));
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
if (eeAvailable)
|
||||||
|
{
|
||||||
|
ee.updateBlock(PersistenceDataAddress, (uint8_t *)&PersistenceData, sizeof(PersistenceData));
|
||||||
|
}
|
||||||
|
#else
|
||||||
EEPROM.put(PersistenceDataAddress, PersistenceData);
|
EEPROM.put(PersistenceDataAddress, PersistenceData);
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
EEPROM.end();
|
EEPROM.end();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetPersistence_EEPROM()
|
void GetPersistence_EEPROM()
|
||||||
{
|
{
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
if (eeAvailable)
|
||||||
|
{
|
||||||
|
eePersistenceMarker = (ee.readByte(0) << 8) | ee.readByte(1);
|
||||||
|
Serial.printf("get EE eePersistenceMarker: 0x%04X\n", eePersistenceMarker);
|
||||||
|
}
|
||||||
|
#else
|
||||||
EEPROM.begin(512);
|
EEPROM.begin(512);
|
||||||
EEPROM.get(0, eePersistenceMarker);
|
EEPROM.get(0, eePersistenceMarker);
|
||||||
uint16_t PersistenceDataAddress = startofPersistence + eePersistenceMarker;
|
#endif
|
||||||
|
|
||||||
|
uint16_t PersistenceDataAddress = startofPersistence + eePersistenceMarker;
|
||||||
|
Serial.printf("get EE PersistenceDataAddress: 0x%04X\n", PersistenceDataAddress);
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
if (eeAvailable)
|
||||||
|
{
|
||||||
|
ee.readBlock(PersistenceDataAddress, (uint8_t *)&PersistenceData, sizeof(PersistenceData));
|
||||||
|
}
|
||||||
|
#else
|
||||||
EEPROM.get(PersistenceDataAddress, PersistenceData);
|
EEPROM.get(PersistenceDataAddress, PersistenceData);
|
||||||
EEPROM.end();
|
EEPROM.end();
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t checksum = PersistenceData.checksum;
|
uint32_t checksum = PersistenceData.checksum;
|
||||||
PersistenceData.checksum = 0;
|
PersistenceData.checksum = 0;
|
||||||
@ -99,6 +149,24 @@ void FormatPersistence_EEPROM()
|
|||||||
StorePersistence_EEPROM();
|
StorePersistence_EEPROM();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MovePersistencePage_EEPROM(boolean reset)
|
||||||
|
{
|
||||||
|
eePersistenceMarker = reset ? sizeof(PersistenceData) : eePersistenceMarker + sizeof(PersistenceData);
|
||||||
|
PersistenceData.writeCycleCounter = 0;
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
ee.updateByte(0, (uint8_t)(eePersistenceMarker >> 8));
|
||||||
|
ee.updateByte(1, (uint8_t)(eePersistenceMarker & 0xFF));
|
||||||
|
#else
|
||||||
|
EEPROM.begin(512);
|
||||||
|
EEPROM.put(0, eePersistenceMarker);
|
||||||
|
#endif
|
||||||
|
Serial.printf("Moving PDS-Page\n");
|
||||||
|
Serial.printf("PersistenceData.writeCycleCounter: 0x%04X\n", PersistenceData.writeCycleCounter);
|
||||||
|
Serial.printf("eePersistenceMarker: 0x%04X\n", eePersistenceMarker);
|
||||||
|
Serial.printf("sizeof(PersistenceData): 0x%04X\n", sizeof(PersistenceData));
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t Checksum_EEPROM(uint8_t const *data, size_t len)
|
uint32_t Checksum_EEPROM(uint8_t const *data, size_t len)
|
||||||
{
|
{
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
@ -112,3 +180,23 @@ uint32_t Checksum_EEPROM(uint8_t const *data, size_t len)
|
|||||||
}
|
}
|
||||||
return crc ^ 0xff;
|
return crc ^ 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dumpEEPROM(uint16_t memoryAddress, uint16_t length)
|
||||||
|
{
|
||||||
|
const int BLOCK_TO_LENGTH = 16;
|
||||||
|
Serial.print("\nAddr. ");
|
||||||
|
for (int x = 0; x < BLOCK_TO_LENGTH; x++)
|
||||||
|
Serial.printf("%3d", x);
|
||||||
|
|
||||||
|
memoryAddress = memoryAddress / BLOCK_TO_LENGTH * BLOCK_TO_LENGTH;
|
||||||
|
length = (length + BLOCK_TO_LENGTH - 1) / BLOCK_TO_LENGTH * BLOCK_TO_LENGTH;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
if (memoryAddress % BLOCK_TO_LENGTH == 0)
|
||||||
|
Serial.printf("\n0x%05X:", memoryAddress);
|
||||||
|
Serial.printf(" %02X", ee.readByte(memoryAddress));
|
||||||
|
memoryAddress++;
|
||||||
|
}
|
||||||
|
Serial.println();
|
||||||
|
}
|
@ -2,14 +2,23 @@
|
|||||||
#define _CONFIG_H_
|
#define _CONFIG_H_
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
#include <Wire.h>
|
||||||
|
#include <I2C_eeprom.h>
|
||||||
|
#else
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC256
|
||||||
|
|
||||||
typedef enum SpeedSource_e
|
typedef enum SpeedSource_e
|
||||||
{
|
{
|
||||||
SOURCE_TIME,
|
SOURCE_TIME,
|
||||||
SOURCE_IMPULSE,
|
SOURCE_IMPULSE,
|
||||||
SOURCE_GPS,
|
SOURCE_GPS,
|
||||||
|
#if PCB_REVISION == 13
|
||||||
SOURCE_CAN
|
SOURCE_CAN
|
||||||
|
#endif
|
||||||
} SpeedSource_t;
|
} SpeedSource_t;
|
||||||
|
|
||||||
typedef enum GPSBaudRate_e
|
typedef enum GPSBaudRate_e
|
||||||
@ -24,6 +33,8 @@ const char GPSBaudRateString[][7] = {
|
|||||||
|
|
||||||
const size_t GPSBaudRateString_Elements = sizeof(GPSBaudRateString) / sizeof(GPSBaudRateString[0]);
|
const size_t GPSBaudRateString_Elements = sizeof(GPSBaudRateString) / sizeof(GPSBaudRateString[0]);
|
||||||
|
|
||||||
|
#if PCB_REVISION == 13
|
||||||
|
|
||||||
typedef enum CANSource_e
|
typedef enum CANSource_e
|
||||||
{
|
{
|
||||||
KTM_890_ADV_R_2021
|
KTM_890_ADV_R_2021
|
||||||
@ -33,12 +44,16 @@ const char CANSourceString[][28] = {
|
|||||||
"KTM 890 Adventure R (2021)"};
|
"KTM 890 Adventure R (2021)"};
|
||||||
|
|
||||||
const char CANSourceString_Elements = sizeof(CANSourceString) / sizeof(CANSourceString[0]);
|
const char CANSourceString_Elements = sizeof(CANSourceString) / sizeof(CANSourceString[0]);
|
||||||
|
#endif
|
||||||
|
|
||||||
const char SpeedSourceString[][8] = {
|
const char SpeedSourceString[][8] = {
|
||||||
"Timer",
|
"Timer",
|
||||||
"Impuls",
|
"Impuls",
|
||||||
"GPS",
|
"GPS",
|
||||||
"CAN-Bus"};
|
#if PCB_REVISION == 13
|
||||||
|
"CAN-Bus"
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
const size_t SpeedSourceString_Elements = sizeof(SpeedSourceString) / sizeof(SpeedSourceString[0]);
|
const size_t SpeedSourceString_Elements = sizeof(SpeedSourceString) / sizeof(SpeedSourceString[0]);
|
||||||
|
|
||||||
@ -65,10 +80,15 @@ typedef struct
|
|||||||
uint8_t BleedingPulses = 25;
|
uint8_t BleedingPulses = 25;
|
||||||
SpeedSource_t SpeedSource = SOURCE_IMPULSE;
|
SpeedSource_t SpeedSource = SOURCE_IMPULSE;
|
||||||
GPSBaudRate_t GPSBaudRate = BAUD_9600;
|
GPSBaudRate_t GPSBaudRate = BAUD_9600;
|
||||||
|
#if PCB_REVISION == 13
|
||||||
CANSource_t CANSource = KTM_890_ADV_R_2021;
|
CANSource_t CANSource = KTM_890_ADV_R_2021;
|
||||||
|
#endif
|
||||||
uint32_t checksum = 0;
|
uint32_t checksum = 0;
|
||||||
} LubeConfig_t;
|
} LubeConfig_t;
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
void InitEEPROM();
|
||||||
|
#endif
|
||||||
void StoreConfig_EEPROM();
|
void StoreConfig_EEPROM();
|
||||||
void GetConfig_EEPROM();
|
void GetConfig_EEPROM();
|
||||||
void StorePersistence_EEPROM();
|
void StorePersistence_EEPROM();
|
||||||
@ -76,6 +96,8 @@ void GetPersistence_EEPROM();
|
|||||||
void FormatConfig_EEPROM();
|
void FormatConfig_EEPROM();
|
||||||
void FormatPersistence_EEPROM();
|
void FormatPersistence_EEPROM();
|
||||||
uint32_t Checksum_EEPROM(uint8_t const *data, size_t len);
|
uint32_t Checksum_EEPROM(uint8_t const *data, size_t len);
|
||||||
|
void dumpEEPROM(uint16_t memoryAddress, uint16_t length);
|
||||||
|
void MovePersistencePage_EEPROM(boolean reset);
|
||||||
|
|
||||||
extern LubeConfig_t LubeConfig;
|
extern LubeConfig_t LubeConfig;
|
||||||
extern persistenceData_t PersistenceData;
|
extern persistenceData_t PersistenceData;
|
||||||
|
@ -7,6 +7,10 @@
|
|||||||
#include <RemoteDebug.h>
|
#include <RemoteDebug.h>
|
||||||
#include <FastLED.h>
|
#include <FastLED.h>
|
||||||
#include <Ticker.h>
|
#include <Ticker.h>
|
||||||
|
#if PCB_REVISION >= 13
|
||||||
|
#include <mcp_can.h>
|
||||||
|
#include <SPI.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "rmtdbghelp.h"
|
#include "rmtdbghelp.h"
|
||||||
@ -23,7 +27,10 @@ const char *password = QUOTE(WIFI_PASSWORD);
|
|||||||
const uint32_t connectTimeoutMs = 5000;
|
const uint32_t connectTimeoutMs = 5000;
|
||||||
|
|
||||||
ESP8266WiFiMulti wifiMulti;
|
ESP8266WiFiMulti wifiMulti;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 13
|
||||||
|
MCP_CAN CAN0(GPIO_CS_CAN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -58,6 +65,9 @@ void Display_Process();
|
|||||||
void Button_Process();
|
void Button_Process();
|
||||||
void toggleWiFiAP(boolean shutdown = false);
|
void toggleWiFiAP(boolean shutdown = false);
|
||||||
void SystemShutdown();
|
void SystemShutdown();
|
||||||
|
#if PCB_REVISION >= 13
|
||||||
|
void Init_CAN();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIFI_CLIENT
|
#ifdef WIFI_CLIENT
|
||||||
void wifiMaintainConnectionTicker_callback();
|
void wifiMaintainConnectionTicker_callback();
|
||||||
@ -68,9 +78,7 @@ Ticker UpdateWebUITicker(updateWebUITicker_callback, 5000, 0, MILLIS);
|
|||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
system_update_cpu_freq(SYS_CPU_80MHZ);
|
system_update_cpu_freq(SYS_CPU_80MHZ);
|
||||||
|
|
||||||
snprintf(DeviceName, 32, HOST_NAME, ESP.getChipId());
|
snprintf(DeviceName, 32, HOST_NAME, ESP.getChipId());
|
||||||
|
|
||||||
WiFi.persistent(false);
|
WiFi.persistent(false);
|
||||||
|
|
||||||
#ifdef WIFI_CLIENT
|
#ifdef WIFI_CLIENT
|
||||||
@ -88,15 +96,24 @@ void setup()
|
|||||||
Serial.println("Souko's ChainLube Mk1");
|
Serial.println("Souko's ChainLube Mk1");
|
||||||
Serial.println(DeviceName);
|
Serial.println(DeviceName);
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 12
|
||||||
|
InitEEPROM();
|
||||||
|
#endif
|
||||||
GetConfig_EEPROM();
|
GetConfig_EEPROM();
|
||||||
GetPersistence_EEPROM();
|
GetPersistence_EEPROM();
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 13
|
||||||
|
Init_CAN();
|
||||||
|
#endif
|
||||||
|
|
||||||
u8x8.begin();
|
u8x8.begin();
|
||||||
u8x8.setFont(u8x8_font_chroma48medium8_r);
|
u8x8.setFont(u8x8_font_chroma48medium8_r);
|
||||||
|
|
||||||
FastLED.addLeds<WS2811, GPIO_LED, GRB>(leds, 1); // GRB ordering is assumed
|
FastLED.addLeds<WS2811, GPIO_LED, GRB>(leds, 1); // GRB ordering is assumed
|
||||||
|
|
||||||
|
#if PCB_REVISION <= 13
|
||||||
pinMode(GPIO_TRIGGER, INPUT_PULLUP);
|
pinMode(GPIO_TRIGGER, INPUT_PULLUP);
|
||||||
|
#endif
|
||||||
pinMode(GPIO_BUTTON, INPUT_PULLUP);
|
pinMode(GPIO_BUTTON, INPUT_PULLUP);
|
||||||
pinMode(GPIO_PUMP, OUTPUT);
|
pinMode(GPIO_PUMP, OUTPUT);
|
||||||
|
|
||||||
@ -199,6 +216,12 @@ void processCmdRemoteDebug()
|
|||||||
RemoteDebug_formatPersistence();
|
RemoteDebug_formatPersistence();
|
||||||
else if (lastCmd == "checkEE")
|
else if (lastCmd == "checkEE")
|
||||||
RemoteDebug_CheckEEPOM();
|
RemoteDebug_CheckEEPOM();
|
||||||
|
else if (lastCmd == "dumpEE1k")
|
||||||
|
dumpEEPROM(0, 1024);
|
||||||
|
else if (lastCmd == "dumpEE")
|
||||||
|
dumpEEPROM(0, EEPROM_SIZE_BYTES);
|
||||||
|
else if (lastCmd == "resetPageEE")
|
||||||
|
MovePersistencePage_EEPROM(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteDebug_formatCFG()
|
void RemoteDebug_formatCFG()
|
||||||
@ -590,3 +613,25 @@ void SystemShutdown()
|
|||||||
StoreConfig_EEPROM();
|
StoreConfig_EEPROM();
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if PCB_REVISION >= 13
|
||||||
|
void Init_CAN()
|
||||||
|
{
|
||||||
|
// Initialize MCP2515 running at 16MHz with a baudrate of 500kb/s and the masks and filters disabled.
|
||||||
|
if (CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK)
|
||||||
|
Serial.println("MCP2515 Initialized Successfully!");
|
||||||
|
else
|
||||||
|
Serial.println("Error Initializing MCP2515...");
|
||||||
|
|
||||||
|
CAN0.setMode(MCP_NORMAL); // Change to normal mode to allow messages to be transmitted
|
||||||
|
}
|
||||||
|
|
||||||
|
void Recieve_CAN()
|
||||||
|
{
|
||||||
|
long unsigned int rxId;
|
||||||
|
unsigned char len = 0;
|
||||||
|
unsigned char rxBuf[8];
|
||||||
|
|
||||||
|
CAN0.readMsgBuf(&rxId, &len, rxBuf); // Read data: len = data length, buf = data byte(s)
|
||||||
|
}
|
||||||
|
#endif
|
@ -2,4 +2,7 @@ const char helpCmd[] = "sysinfo - System Info\r\n"
|
|||||||
"netinfo - WiFi Info\r\n"
|
"netinfo - WiFi Info\r\n"
|
||||||
"formatPDS - Format Persistence EEPROM Data\r\n"
|
"formatPDS - Format Persistence EEPROM Data\r\n"
|
||||||
"formatCFG - Format Configuration EEPROM Data\r\n"
|
"formatCFG - Format Configuration EEPROM Data\r\n"
|
||||||
"checkEE - Check EEPROM with checksum\r\n";
|
"checkEE - Check EEPROM with checksum\r\n"
|
||||||
|
"dumpEE1k - This will dump the first 1kb of EEPROM to Serial\r\n"
|
||||||
|
"dumpEE - This will dump the whole EPPROM to Serial\r\n"
|
||||||
|
"resetPageEE - This will Reset the PersistenceData Page\r\n";
|
@ -133,7 +133,7 @@ void initWebUI()
|
|||||||
|
|
||||||
option_speedsource = ESPUI.addControl(ControlType::Select, "Geschwindigkeit Quelle", "", ControlColor::Wetasphalt, tab_wheel, &speedSourceSelect_callback);
|
option_speedsource = ESPUI.addControl(ControlType::Select, "Geschwindigkeit Quelle", "", ControlColor::Wetasphalt, tab_wheel, &speedSourceSelect_callback);
|
||||||
button_changeSource = ESPUI.addControl(ControlType::Button, "neue Quelle übernehmen. ACHTUNG: Gerät startet neu!", "Übernehmen", ControlColor::Wetasphalt, tab_wheel, &speedSourceSelect_callback);
|
button_changeSource = ESPUI.addControl(ControlType::Button, "neue Quelle übernehmen. ACHTUNG: Gerät startet neu!", "Übernehmen", ControlColor::Wetasphalt, tab_wheel, &speedSourceSelect_callback);
|
||||||
for (int i = 0; i < SpeedSourceString_Elements; i++)
|
for (int i = 0; i < (int)SpeedSourceString_Elements; i++)
|
||||||
{
|
{
|
||||||
ESPUI.addControl(ControlType::Option, SpeedSourceString[i], String(i), ControlColor::Wetasphalt, option_speedsource);
|
ESPUI.addControl(ControlType::Option, SpeedSourceString[i], String(i), ControlColor::Wetasphalt, option_speedsource);
|
||||||
}
|
}
|
||||||
@ -155,6 +155,7 @@ void initWebUI()
|
|||||||
ESPUI.addControl(ControlType::Option, GPSBaudRateString[i], String(i), ControlColor::Peterriver, option_gps_baudrate);
|
ESPUI.addControl(ControlType::Option, GPSBaudRateString[i], String(i), ControlColor::Peterriver, option_gps_baudrate);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#if PCB_REVISION >= 13
|
||||||
case SOURCE_CAN:
|
case SOURCE_CAN:
|
||||||
option_can_source = ESPUI.addControl(ControlType::Select, "CAN-Bus Quelle", "", ControlColor::Peterriver, tab_wheel, &SettingChanged_Callback);
|
option_can_source = ESPUI.addControl(ControlType::Select, "CAN-Bus Quelle", "", ControlColor::Peterriver, tab_wheel, &SettingChanged_Callback);
|
||||||
for (int i = 0; i < CANSourceString_Elements; i++)
|
for (int i = 0; i < CANSourceString_Elements; i++)
|
||||||
@ -162,6 +163,7 @@ void initWebUI()
|
|||||||
ESPUI.addControl(ControlType::Option, CANSourceString[i], String(i), ControlColor::Peterriver, option_can_source);
|
ESPUI.addControl(ControlType::Option, CANSourceString[i], String(i), ControlColor::Peterriver, option_can_source);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case SOURCE_TIME:
|
case SOURCE_TIME:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user