Mercurial > public > ostc4
comparison Discovery/Src/tMenuEditSystem.c @ 424:2b31cf1ebbcc ImprovmentNVM_2
Added (optional) menu item to analyse log sample buffer:
The analysis function will check the ring buffer for proper closure of sectors. In case of a log sample ring corruption more than sector will show the state started (4). Depending on the time past since corruption and the location of the corrupted sector, a cleanup function will be executed if a dive is started. The dive is necessary because of the definition of sample position during OSTC startup phase.
author | ideenmodellierer |
---|---|
date | Sat, 15 Feb 2020 20:45:19 +0100 |
parents | e729b8e7654d |
children | 8851702173e0 |
comparison
equal
deleted
inserted
replaced
423:a560afdaadbf | 424:2b31cf1ebbcc |
---|---|
39 #include "tMenuEdit.h" | 39 #include "tMenuEdit.h" |
40 #include "tMenuSystem.h" | 40 #include "tMenuSystem.h" |
41 #include "motion.h" | 41 #include "motion.h" |
42 #include "t7.h" | 42 #include "t7.h" |
43 | 43 |
44 /* Uncomment to activate a menu item in reset menu which provide sample ring analysis / repair functionality */ | |
45 #define ENABLE_ANALYSE_SAMPLES | |
44 | 46 |
45 #define CV_SUBPAGE_MAX (2u) /* max number of customer view selection pages */ | 47 #define CV_SUBPAGE_MAX (2u) /* max number of customer view selection pages */ |
46 /*#define HAVE_DEBUG_VIEW */ | 48 /*#define HAVE_DEBUG_VIEW */ |
47 static uint8_t infoPage = 0; | 49 static uint8_t infoPage = 0; |
48 | 50 |
93 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 95 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
94 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 96 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
95 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 97 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
96 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 98 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
97 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 99 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
100 uint8_t OnAction_RecoverSampleIdx(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
98 #ifdef SCREENTEST | 101 #ifdef SCREENTEST |
99 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 102 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
100 #endif | 103 #endif |
101 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | 104 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
102 /* | 105 /* |
1468 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetLogbook); | 1471 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetLogbook); |
1469 break; | 1472 break; |
1470 | 1473 |
1471 case StMSYS6_Maintenance: | 1474 case StMSYS6_Maintenance: |
1472 case StMSYS6_SetBattCharge: | 1475 case StMSYS6_SetBattCharge: |
1476 case StMSYS6_SetSampleIndx: | |
1473 text[0] = TXT_2BYTE; | 1477 text[0] = TXT_2BYTE; |
1474 text[1] = TXT2BYTE_SetFactoryDefaults; | 1478 text[1] = TXT2BYTE_SetFactoryDefaults; |
1475 text[2] = 0; | 1479 text[2] = 0; |
1476 write_field_button(StMSYS6_SetFactoryBC, 30, 800, ME_Y_LINE2, &FontT48, text); | 1480 write_field_button(StMSYS6_SetFactoryBC, 30, 800, ME_Y_LINE2, &FontT48, text); |
1481 | |
1482 #ifdef ENABLE_ANALYSE_SAMPLES | |
1483 text[0] = TXT_2BYTE; | |
1484 text[1] = TXT2BYTE_SetSampleIndex; | |
1485 text[2] = 0; | |
1486 write_field_button(StMSYS6_SetSampleIndx, 30, 800, ME_Y_LINE3, &FontT48, text); | |
1487 #endif | |
1488 | |
1477 | 1489 |
1478 if(stateRealGetPointer()->lifeData.battery_charge == 0) | 1490 if(stateRealGetPointer()->lifeData.battery_charge == 0) |
1479 { | 1491 { |
1480 text[0] = TXT_2BYTE; | 1492 text[0] = TXT_2BYTE; |
1481 text[1] = TXT2BYTE_SetBatteryCharge; | 1493 text[1] = TXT2BYTE_SetBatteryCharge; |
1482 text[2] = 0; | 1494 text[2] = 0; |
1483 snprintf(&text[2],10,": %u%%",settingsGetPointer()->lastKnownBatteryPercentage); | 1495 snprintf(&text[2],10,": %u%%",settingsGetPointer()->lastKnownBatteryPercentage); |
1496 #ifdef ENABLE_ANALYSE_SAMPLES | |
1497 write_field_button(StMSYS6_SetBattCharge, 30, 800, ME_Y_LINE4, &FontT48, text); | |
1498 #else | |
1484 write_field_button(StMSYS6_SetBattCharge, 30, 800, ME_Y_LINE3, &FontT48, text); | 1499 write_field_button(StMSYS6_SetBattCharge, 30, 800, ME_Y_LINE3, &FontT48, text); |
1500 #endif | |
1485 | 1501 |
1486 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | 1502 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); |
1487 setEvent(StMSYS6_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); | 1503 setEvent(StMSYS6_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); |
1504 #ifdef ENABLE_ANALYSE_SAMPLES | |
1505 setEvent(StMSYS6_SetSampleIndx, (uint32_t)OnAction_RecoverSampleIdx); | |
1506 #endif | |
1488 setEvent(StMSYS6_SetBattCharge, (uint32_t)OnAction_SetBatteryCharge); | 1507 setEvent(StMSYS6_SetBattCharge, (uint32_t)OnAction_SetBatteryCharge); |
1489 } | 1508 } |
1490 else | 1509 else |
1491 { | 1510 { |
1492 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | 1511 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); |
1493 setEvent(StMSYS6_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); | 1512 setEvent(StMSYS6_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); |
1513 #ifdef ENABLE_ANALYSE_SAMPLES | |
1514 setEvent(StMSYS6_SetSampleIndx, (uint32_t)OnAction_RecoverSampleIdx); | |
1515 #endif | |
1494 } | 1516 } |
1495 // write_field_button(StMSYS6_ScreenTest, 30, 800, ME_Y_LINE3, &FontT48, "Screen Test"); | 1517 // write_field_button(StMSYS6_ScreenTest, 30, 800, ME_Y_LINE3, &FontT48, "Screen Test"); |
1496 // setEvent(StMSYS6_ScreenTest, (uint32_t)OnAction_ScreenTest); | 1518 // setEvent(StMSYS6_ScreenTest, (uint32_t)OnAction_ScreenTest); |
1497 | 1519 |
1498 text[0] = TXT_2BYTE; | 1520 text[0] = TXT_2BYTE; |
1606 { | 1628 { |
1607 settingsWriteFactoryDefaults(settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->buttonBalance); | 1629 settingsWriteFactoryDefaults(settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->buttonBalance); |
1608 return EXIT_TO_MENU; | 1630 return EXIT_TO_MENU; |
1609 } | 1631 } |
1610 | 1632 |
1633 | |
1634 uint8_t OnAction_RecoverSampleIdx(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1635 { | |
1636 char text[32]; | |
1637 char strResult[20]; | |
1638 | |
1639 | |
1640 ext_flash_AnalyseSampleBuffer(strResult); | |
1641 snprintf(&text[0],30,"Ring: %s",strResult); //"Code: %X",settingsGetPointer()->logFlashNextSampleStartAddress); //getLicence()); | |
1642 write_label_var( 30, 800, ME_Y_LINE6, &FontT42, text); | |
1643 return UNSPECIFIC_RETURN; | |
1644 } | |
1611 | 1645 |
1612 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | 1646 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
1613 { | 1647 { |
1614 setBatteryPercentage(settingsGetPointer()->lastKnownBatteryPercentage); | 1648 setBatteryPercentage(settingsGetPointer()->lastKnownBatteryPercentage); |
1615 // setBatteryPercentage(100); | 1649 // setBatteryPercentage(100); |