Mercurial > public > ostc4
comparison Discovery/Src/t7.c @ 361:b111fc4250e9 MotionDetection
Pass action to customer vie update function.
By intoducing shakes the reason for calling an update may not only be the middle button. To be able to handle positiv and negativ shake events the action is now provided to the update function
author | Ideenmodellierer |
---|---|
date | Tue, 11 Jun 2019 05:30:09 +0200 |
parents | 3949781096d4 |
children | c18aebb03fed |
comparison
equal
deleted
inserted
replaced
360:fc5e9fdcb156 | 361:b111fc4250e9 |
---|---|
1477 { | 1477 { |
1478 if(stateUsed->mode == MODE_DIVE) | 1478 if(stateUsed->mode == MODE_DIVE) |
1479 selection_customview = settingsGetPointer()->tX_customViewPrimary; | 1479 selection_customview = settingsGetPointer()->tX_customViewPrimary; |
1480 } | 1480 } |
1481 | 1481 |
1482 void t7_change_customview(void) | 1482 void t7_change_customview(uint8_t action) |
1483 { | 1483 { |
1484 const uint8_t *pViews; | 1484 const uint8_t *pViews; |
1485 uint8_t *pStartView,*pCurView, *pLastView; | |
1485 _Bool cv_disabled = 0; | 1486 _Bool cv_disabled = 0; |
1486 | 1487 |
1487 if(stateUsed->mode == MODE_DIVE) | 1488 if(stateUsed->mode == MODE_DIVE) |
1488 pViews = customviewsDive; | 1489 pViews = customviewsDive; |
1489 else | 1490 else |
1490 pViews = customviewsSurface; | 1491 pViews = customviewsSurface; |
1491 | 1492 |
1492 while((*pViews != CVIEW_END) && (*pViews != selection_customview)) | 1493 pStartView = pViews; |
1493 {pViews++;} | 1494 /* set pointer to currently selected view and count number of entries */ |
1494 | 1495 while((*pViews != CVIEW_END)) |
1495 if(*pViews < CVIEW_END) | 1496 { |
1496 pViews++; | 1497 if (*pViews == selection_customview) |
1497 | 1498 { |
1498 | 1499 pCurView = pViews; |
1499 if(*pViews == CVIEW_END) | 1500 } |
1500 { | 1501 pViews++; |
1501 if(stateUsed->mode == MODE_DIVE) | 1502 } |
1502 pViews = customviewsDive; | 1503 pLastView = pViews; |
1503 else | 1504 pViews = pCurView; |
1504 pViews = customviewsSurface; | 1505 |
1505 } | 1506 if((action == ACTION_BUTTON_ENTER) || (action == ACTION_SHAKE_POS)) |
1506 | 1507 { |
1508 if(*pViews < CVIEW_END) | |
1509 pViews++; | |
1510 | |
1511 if(*pViews == CVIEW_END) | |
1512 { | |
1513 pViews = pStartView; | |
1514 } | |
1515 } | |
1516 else | |
1517 { | |
1518 pViews--; | |
1519 if(pViews = pStartView) | |
1520 { | |
1521 pViews = pLastView - 1; | |
1522 } | |
1523 } | |
1507 if(stateUsed->mode == MODE_DIVE) | 1524 if(stateUsed->mode == MODE_DIVE) |
1508 { | 1525 { |
1509 do | 1526 do |
1510 { | 1527 { |
1511 cv_disabled = 0; | 1528 cv_disabled = 0; |
1522 stateUsed->diveSettings.ppo2sensors_deactivated) | 1539 stateUsed->diveSettings.ppo2sensors_deactivated) |
1523 { | 1540 { |
1524 cv_disabled = 1; | 1541 cv_disabled = 1; |
1525 } | 1542 } |
1526 | 1543 |
1527 if(cv_disabled) | 1544 if(cv_disabled) /* view is disabled => jump to next view */ |
1528 { | 1545 { |
1529 if(*pViews < CVIEW_END) | 1546 if((action == ACTION_BUTTON_ENTER) || (action == ACTION_SHAKE_POS)) |
1530 { | 1547 { |
1531 pViews++; | 1548 pViews++; |
1532 } | 1549 if(*pViews == CVIEW_END) |
1533 else | 1550 { |
1534 { | 1551 pViews = pStartView; |
1535 pViews = customviewsDive; | 1552 } |
1536 } | 1553 } |
1554 else | |
1555 { | |
1556 pViews--; | |
1557 if(pViews == pStartView) | |
1558 { | |
1559 pViews = pLastView - 1; | |
1560 } | |
1561 } | |
1537 } | 1562 } |
1538 } while(cv_disabled); | 1563 } while(cv_disabled); |
1539 } | 1564 } |
1540 selection_customview = *pViews; | 1565 selection_customview = *pViews; |
1541 } | 1566 } |
1568 | 1593 |
1569 SSettings* pSettings; | 1594 SSettings* pSettings; |
1570 pSettings = settingsGetPointer(); | 1595 pSettings = settingsGetPointer(); |
1571 | 1596 |
1572 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) | 1597 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) |
1573 t7_change_customview(); | 1598 t7_change_customview(ACTION_BUTTON_ENTER); |
1574 if((selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0)) | 1599 if((selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0)) |
1575 t7_change_customview(); | 1600 t7_change_customview(ACTION_BUTTON_ENTER); |
1576 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) | 1601 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) |
1577 t7_change_customview(); | 1602 t7_change_customview(ACTION_BUTTON_ENTER); |
1578 | 1603 |
1579 switch(selection_customview) | 1604 switch(selection_customview) |
1580 { | 1605 { |
1581 case CVIEW_noneOrDebug: | 1606 case CVIEW_noneOrDebug: |
1582 if(settingsGetPointer()->showDebugInfo) | 1607 if(settingsGetPointer()->showDebugInfo) |