This commit is contained in:
parent
19e032f6a8
commit
514a1e2fa8
|
@ -74,6 +74,8 @@ int InitConfiguration() {
|
|||
if ((flashState != MFS_NO_ERROR) || size != GetConfigurationSize() || !configuration.IsValid()) {
|
||||
/* load defaults */
|
||||
configuration.resetToDefaults();
|
||||
} else {
|
||||
configuration.rebootCounter++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
struct TestConfiguration {
|
||||
void resetToDefaults() {
|
||||
version = PERSISTENCE_VERSION;
|
||||
updateCounter = 20;
|
||||
updateCounter = 100;
|
||||
rebootCounter = 0;
|
||||
}
|
||||
bool IsValid() const {
|
||||
return version == PERSISTENCE_VERSION;
|
||||
|
@ -17,6 +18,7 @@ struct TestConfiguration {
|
|||
|
||||
int version;
|
||||
int updateCounter;
|
||||
int rebootCounter;
|
||||
};
|
||||
|
||||
int InitConfiguration();
|
||||
|
|
|
@ -34,7 +34,7 @@ static THD_WORKING_AREA(waUartThread, 256);
|
|||
static void UartThread(void*)
|
||||
{
|
||||
while (true) {
|
||||
size_t writeCount = chsnprintf(printBuffer, 200, "%d.%03d\t%d\t%d\r\n", 0, (int)flashState, configuration.updateCounter, 100);
|
||||
size_t writeCount = chsnprintf(printBuffer, 200, "%d.%03d\twrites=%d\treboots=%d\r\n", 0, (int)flashState, configuration.updateCounter, configuration.rebootCounter);
|
||||
uartStartSend(&UARTD1, writeCount, printBuffer);
|
||||
|
||||
pokeConfiguration();
|
||||
|
|
Loading…
Reference in New Issue