Mercurial > public > ostc4
comparison Discovery/Src/data_exchange_main.c @ 421:3f7d80f37bfc ImprovmentNVM_2
Enable sequentionel writing of device data:
DeviceData was always written to the start of the the DD ringbuffer causing everytime a sector erase delay (~200ms). To avoid this the ring buffer functionality has been activated.
To be backward compatible the latest DD set will be written to DD ring buffer start at shutdown time.
In case of a reset the firmware scans for the latest DD block and restores its content giving the same data consistency intervall (10 minutes) as the previous implementation without having the 200ms penality for sector erases
author | ideenmodellierer |
---|---|
date | Mon, 10 Feb 2020 19:25:09 +0100 |
parents | b11e50415982 |
children | 079f32a8e68c |
comparison
equal
deleted
inserted
replaced
420:2174fb133dbe | 421:3f7d80f37bfc |
---|---|
638 | 638 |
639 dataLengthRead = ext_flash_read_devicedata((uint8_t *)&DeviceDataFlash,sizeof(SDevice)); | 639 dataLengthRead = ext_flash_read_devicedata((uint8_t *)&DeviceDataFlash,sizeof(SDevice)); |
640 | 640 |
641 if(dataLengthRead == 0) | 641 if(dataLengthRead == 0) |
642 { | 642 { |
643 ext_flash_write_devicedata(); | 643 ext_flash_write_devicedata(false); |
644 return; | 644 return; |
645 } | 645 } |
646 | 646 |
647 /* max values */ | 647 /* max values */ |
648 if(DeviceData->batteryChargeCompleteCycles.value_int32 < DeviceDataFlash.batteryChargeCompleteCycles.value_int32) | 648 if(DeviceData->batteryChargeCompleteCycles.value_int32 < DeviceDataFlash.batteryChargeCompleteCycles.value_int32) |
680 { | 680 { |
681 DataEX_helper_copy_deviceData(&DeviceData->voltageMinimum, &DeviceDataFlash.voltageMinimum); | 681 DataEX_helper_copy_deviceData(&DeviceData->voltageMinimum, &DeviceDataFlash.voltageMinimum); |
682 } | 682 } |
683 | 683 |
684 DataEX_check_DeviceData (); | 684 DataEX_check_DeviceData (); |
685 ext_flash_write_devicedata(); | 685 ext_flash_write_devicedata(false); |
686 } | 686 } |
687 | 687 |
688 | 688 |
689 static void DataEX_copy_to_DeviceData(void) | 689 static void DataEX_copy_to_DeviceData(void) |
690 { | 690 { |