Fix pages 13 and 14 EEPROM allocation (#487)

* Fix pages 13 and 14 EEPROM allocation

* Update must start from the end of EEPROM

* Fix allocation
This commit is contained in:
Vitor Moreno B. Sales 2021-02-01 19:41:51 -03:00 committed by GitHub
parent c7c0076e3b
commit c59153a9d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 8 deletions

View File

@ -162,14 +162,14 @@ Current layout of EEPROM data (Version 3) is as follows (All sizes are in bytes)
#define EEPROM_CONFIG12_XBINS 2451
#define EEPROM_CONFIG12_YBINS 2459
#define EEPROM_CONFIG12_END 2467
#define EEPROM_CONFIG13_START 2468
#define EEPROM_CONFIG13_END 2596
#define EEPROM_CONFIG14_XSIZE 2596
#define EEPROM_CONFIG14_YSIZE 2597
#define EEPROM_CONFIG14_MAP 2598
#define EEPROM_CONFIG14_XBINS 2854
#define EEPROM_CONFIG14_YBINS 2870
#define EEPROM_CONFIG14_END 2886
#define EEPROM_CONFIG13_START 2580
#define EEPROM_CONFIG13_END 2708
#define EEPROM_CONFIG14_XSIZE 2708
#define EEPROM_CONFIG14_YSIZE 2709
#define EEPROM_CONFIG14_MAP 2710
#define EEPROM_CONFIG14_XBINS 2966
#define EEPROM_CONFIG14_YBINS 2982
#define EEPROM_CONFIG14_END 2998
//Calibration data is stored at the end of the EEPROM (This is in case any further calibration tables are needed as they are large blocks)

View File

@ -438,6 +438,11 @@ void doUpdates()
configPage10.spark2Mode = 0; //Disable 2nd spark table
//Fix for wrong placed page 13
for(int x=EEPROM_CONFIG14_END; x>=EEPROM_CONFIG13_START; x--)
{
EEPROM.update(x, EEPROM.read(x-112));
}
writeAllConfig();
EEPROM.write(EEPROM_DATA_VERSION, 16);
}
@ -446,6 +451,17 @@ void doUpdates()
if( (EEPROM.read(EEPROM_DATA_VERSION) == 0) || (EEPROM.read(EEPROM_DATA_VERSION) == 255) )
{
configPage9.true_address = 0x200;
//Programmable outputs added. Set all to disabled
configPage13.outputPin[0] = 0;
configPage13.outputPin[1] = 0;
configPage13.outputPin[2] = 0;
configPage13.outputPin[3] = 0;
configPage13.outputPin[4] = 0;
configPage13.outputPin[5] = 0;
configPage13.outputPin[6] = 0;
configPage13.outputPin[7] = 0;
EEPROM.write(EEPROM_DATA_VERSION, CURRENT_DATA_VERSION);
}