Ugly Hack to get rid of the startstorage() function.
This commit is contained in:
parent
caa1c676f3
commit
05a2414d9f
|
@ -20,7 +20,6 @@ void initialiseAll()
|
||||||
{
|
{
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
pinMode(LED_BUILTIN, OUTPUT);
|
||||||
digitalWrite(LED_BUILTIN, LOW);
|
digitalWrite(LED_BUILTIN, LOW);
|
||||||
startstorage();
|
|
||||||
table3D_setSize(&fuelTable, 16);
|
table3D_setSize(&fuelTable, 16);
|
||||||
table3D_setSize(&fuelTable2, 16);
|
table3D_setSize(&fuelTable2, 16);
|
||||||
table3D_setSize(&ignitionTable, 16);
|
table3D_setSize(&ignitionTable, 16);
|
||||||
|
|
|
@ -41,7 +41,7 @@ SPIAsEEPROM::SPIAsEEPROM()
|
||||||
|
|
||||||
}
|
}
|
||||||
uint8_t SPIAsEEPROM::begin() {
|
uint8_t SPIAsEEPROM::begin() {
|
||||||
uint8_t SpiFlashAvialable = 0;
|
|
||||||
SpiFlashAvialable = winbondSPIFlash.begin(_W25Q16,SPI,PB0);
|
SpiFlashAvialable = winbondSPIFlash.begin(_W25Q16,SPI,PB0);
|
||||||
uint8_t formatted = 0;
|
uint8_t formatted = 0;
|
||||||
if(SpiFlashAvialable){
|
if(SpiFlashAvialable){
|
||||||
|
@ -174,6 +174,10 @@ uint8_t SPIAsEEPROM::read(uint16_t addressEEPROM){
|
||||||
//The first two pages will be used for the infoblock
|
//The first two pages will be used for the infoblock
|
||||||
//The first 4 bytes of each page must have the magic number
|
//The first 4 bytes of each page must have the magic number
|
||||||
//version 0.1 does not check magic number
|
//version 0.1 does not check magic number
|
||||||
|
if(!SpiFlashAvialable){
|
||||||
|
begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8_t buf[INFOBYTES_PER_BYTE];
|
uint8_t buf[INFOBYTES_PER_BYTE];
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
class SPIAsEEPROM {
|
class SPIAsEEPROM {
|
||||||
private:
|
private:
|
||||||
winbondFlashSPI winbondSPIFlash;
|
winbondFlashSPI winbondSPIFlash;
|
||||||
|
uint8_t SpiFlashAvialable = 0;
|
||||||
uint8_t ReadOutBuffer[BYTESPERSECTOR];
|
uint8_t ReadOutBuffer[BYTESPERSECTOR];
|
||||||
uint8_t magicbuf[4];
|
uint8_t magicbuf[4];
|
||||||
uint16_t sectorNumber;
|
uint16_t sectorNumber;
|
||||||
|
|
|
@ -11,12 +11,6 @@ A full copy of the license may be found in the projects root directory
|
||||||
#include EEPROM_LIB_H //This is defined in the board .h files
|
#include EEPROM_LIB_H //This is defined in the board .h files
|
||||||
#include "storage.h"
|
#include "storage.h"
|
||||||
|
|
||||||
void startstorage(){
|
|
||||||
#if defined(SPIFLASH_AS_EEPROM)
|
|
||||||
EEPROM.begin();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeAllConfig()
|
void writeAllConfig()
|
||||||
{
|
{
|
||||||
writeConfig(veSetPage);
|
writeConfig(veSetPage);
|
||||||
|
|
Loading…
Reference in New Issue