Bugfix writing temperature calibrations

Bug fix sram region to large
This commit is contained in:
hoogendijkta 2019-09-19 20:32:44 +02:00
parent 2137969b7c
commit 08904904d5
3 changed files with 108 additions and 42 deletions

View File

@ -1641,9 +1641,10 @@ void receiveCalibration(byte tableID)
bool every2nd = true;
int x;
int counter = 0;
pinMode(LED_BUILTIN, OUTPUT); //pinMode(13, OUTPUT);
// stm32 board has buildin led used as fuel pump
// pinMode(LED_BUILTIN, OUTPUT); //pinMode(13, OUTPUT);
digitalWrite(LED_BUILTIN, LOW); //digitalWrite(13, LOW);
// digitalWrite(LED_BUILTIN, LOW); //digitalWrite(13, LOW);
for (x = 0; x < 1024; x++)
{
//UNlike what is listed in the protocol documentation, the O2 sensor values are sent as bytes rather than ints
@ -1682,6 +1683,8 @@ void receiveCalibration(byte tableID)
every2nd = false;
#if defined(CORE_STM32)
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
#elif defined(CORE_STM32_OFFICIAL)
//Of core offical do nothing. led is reserved for fuel pump
#else
analogWrite(LED_BUILTIN, (counter % 50) ); //analogWrite(13, (counter % 50) );
#endif

View File

@ -1020,6 +1020,7 @@ void setPinMapping(byte boardID)
pinCoil3 = 30;
pinO2 = A22;
#elif defined(STM32F4)
//Pin definitions for experimental board Tjeerd
//Black F407VE wiki.stm32duino.com/index.php?title=STM32F407
//PC8~PC12 SDio
//PA13~PA15 & PB4 SWD(debug) pins
@ -1677,46 +1678,108 @@ void setPinMapping(byte boardID)
default:
#if defined(STM32F4)
//Pin definitions for experimental board Tjeerd
//Black F407VE wiki.stm32duino.com/index.php?title=STM32F407
//PC8~PC12 SDio
//PA13~PA15 & PB4 SWD(debug) pins
//PB0 EEPROM CS pin
//PA9 & PD10 Serial1
//PD5 & PD6 Serial2
pinInjector1 = PE7; //Output pin injector 1 is on
pinInjector2 = PE8; //Output pin injector 2 is on
pinInjector3 = PE9; //Output pin injector 3 is on
pinInjector4 = PE10; //Output pin injector 4 is on
pinInjector5 = PE11; //Output pin injector 5 is on
pinInjector6 = PE12; //Output pin injector 6 is on
pinCoil1 = PD0; //Pin for coil 1
pinCoil2 = PD1; //Pin for coil 2
pinCoil3 = PD2; //Pin for coil 3
pinCoil4 = PD3; //Pin for coil 4
pinCoil5 = PD4; //Pin for coil 5
pinTPS = A0; //TPS input pin
pinMAP = A1; //MAP sensor pin
pinIAT = A2; //IAT sensor pin
pinCLT = A3; //CLT sensor pin
pinO2 = A4; //O2 Sensor pin
pinBat = A5; //Battery reference voltage pin
pinBaro = A9;
pinIdle1 = PB8; //Single wire idle control
pinIdle2 = PB9; //2 wire idle control
pinBoost = PE0; //Boost control
pinVVT_1 = PE1; //Default VVT output
pinStepperDir = PD8; //Direction pin for DRV8825 driver
pinStepperStep = PB15; //Step pin for DRV8825 driver
pinStepperEnable = PD9; //Enable pin for DRV8825
pinDisplayReset = PE1; // OLED reset pin
pinFan = PE2; //Pin for the fan output
pinFuelPump = PC0; //Fuel pump output
pinTachOut = PC1; //Tacho output pin
//external interrupt enabled pins
//external interrupts could be enalbed in any pin, except same port numbers (PA4,PE4)
pinFlex = PE2; // Flex sensor (Must be external interrupt enabled)
pinTrigger = PE3; //The CAS pin
pinTrigger2 = PE4; //The Cam Sensor pin
//******************************************
//******** PORTA CONNECTIONS ***************
//******************************************
// = PA0 //Wakeup ADC123
pinTPS = PA1; //ADC123
pinMAP = PA2; //ADC123
pinIAT = PA3; //ADC123
pinCLT = PA4; //ADC12
pinO2 = PA5; //ADC12
pinFan = PA6; //ADC12 LED_BUILTIN_1
pinFuelPump = PA7; //ADC12 LED_BUILTIN_2
pinIdle1 = PA8; //
// = PA9; //TXD1
// = PA10; //RXD1
// = PA11; //(DO NOT USE FOR SPEEDUINO) USB
// = PA12; //(DO NOT USE FOR SPEEDUINO) USB
// = PA13; //(DO NOT USE FOR SPEEDUINO) //NOT ON GPIO //DEBUG ST-LINK
// = PA14; //(DO NOT USE FOR SPEEDUINO) //NOT ON GPIO //DEBUG ST-LINK
// = PA15; //(DO NOT USE FOR SPEEDUINO) //NOT ON GPIO //DEBUG ST-LINK
//******************************************
//******** PORTB CONNECTIONS ***************
//******************************************
pinBat = PB0; //ADC12
pinBaro = PB1; //ADC12
// = PB2; //(DO NOT USE FOR SPEEDUINO) BOOT1
// = PB3; //(DO NOT USE FOR SPEEDUINO) SPI1_SCK FLASH CHIP
// = PB4; //(DO NOT USE FOR SPEEDUINO) SPI1_MISO FLASH CHIP
// = PB5; //(DO NOT USE FOR SPEEDUINO) SPI1_MOSI FLASH CHIP
// = PB6; //NRF_CE
// = PB7; //NRF_CS
// = PB8; //NRF_IRQ
pinIdle2 = PB9; //
// = PB10; //TXD3
// = PB11; //RXD3
pinBoost = PB12; //
// = PB13; //SPI2_SCK
// = PB14; //SPI2_MISO
// = PB15; //SPI2_MOSI
//******************************************
//******** PORTC CONNECTIONS ***************
//******************************************
// = PC0; (DO NOT USE FOR SPEEDUINO)//ADC123 //SPI FLASH CHIP CS pin
// = PC1; //ADC123
// = PC2; //ADC123
// = PC3; //ADC123
// = PC4; //ADC12
// = PC5; //ADC12
pinVVT_1 = PC6; //
pinDisplayReset = PC7; //
// = PC8; //(DO NOT USE FOR SPEEDUINO) //SDIO_D0
// = PC9; //(DO NOT USE FOR SPEEDUINO) //SDIO_D1
// = PC10; //(DO NOT USE FOR SPEEDUINO) //SDIO_D2
// = PC11; //(DO NOT USE FOR SPEEDUINO) //SDIO_D3
// = PC12; //(DO NOT USE FOR SPEEDUINO) //SDIO_SCK
pinTachOut = PC13; //
// = PC14; //(DO NOT USE FOR SPEEDUINO) //OSC32_IN
// = PC15; //(DO NOT USE FOR SPEEDUINO) //OSC32_OUT
//******************************************
//******** PORTD CONNECTIONS ***************
//******************************************
// = PD0; //CANRX
// = PD1; //CANTX
// = PD2; //(DO NOT USE FOR SPEEDUINO) //SDIO_CMD
pinCoil1 = PD3; //
pinCoil2 = PD4; //
// = PD5;//TXD2
// = PD6; //RXD2
pinCoil3 = PD7; //
pinCoil4 = PD8; //
pinCoil5 = PD9;//
// = PD10; //
// = PD11; //
// = PD12; //
// = PD13; //
// = PD14; //
// = PD15; //
//******************************************
//******** PORTE CONNECTIONS ***************
//******************************************
pinStepperDir = PE0; //
pinStepperStep = PE1; //
pinStepperEnable = PE2; //
// = PE3; //ONBOARD KEY1
// = PE4; //ONBOARD KEY2
pinFlex = PE5; //
pinTrigger = PE6; //
pinInjector1 = PE7; //
pinInjector2 = PE8; //
pinInjector3 = PE9; //
pinInjector4 = PE10; //
pinInjector5 = PE11; //
pinInjector6 = PE12; //
pinTrigger2 = PE13; //
// = PE14; //
// = PE15; //
#else
#ifndef SMALL_FLASH_MODE //No support for bluepill here anyway
//Pin mappings as per the v0.2 shield

View File

@ -12,7 +12,7 @@
class BackupSramAsEEPROM {
private:
const uint16_t backup_size = 0x4000; //maximum of 4kb backuped sram available.
const uint16_t backup_size = 4096; //maximum of 4kb backuped sram available.
int8_t write_byte( uint8_t *data, uint16_t bytes, uint16_t offset );
int8_t read_byte( uint8_t *data, uint16_t bytes, uint16_t offset );