comparison Discovery/Src/t7.c @ 405:73db1565220b Improment_NVM

Bugfix Display of Sensor values: At divestart sensor values were shown even sensors were deactivated (fix SP). During iterating though customer views they were no longe be displayed. In the code were several if conditions for this cased => created new function and replaced local if conditions with new function to have a constistence behavior
author ideenmodellierer
date Sun, 12 Jan 2020 17:47:02 +0100
parents b57f497726f7
children 2b4440f75434
comparison
equal deleted inserted replaced
404:e729b8e7654d 405:73db1565220b
46 void t7_refresh_surface_debugmode(void); 46 void t7_refresh_surface_debugmode(void);
47 void t7_refresh_divemode(void); 47 void t7_refresh_divemode(void);
48 void t7_refresh_sleep_design_fun(void); 48 void t7_refresh_sleep_design_fun(void);
49 void t7_refresh_divemode_userselected_left_lower_corner(void); 49 void t7_refresh_divemode_userselected_left_lower_corner(void);
50 void t7_refresh_customview(void); 50 void t7_refresh_customview(void);
51 uint8_t t7_customview_disabled(uint8_t view);
51 52
52 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide); 53 void draw_frame(_Bool PluginBoxHeader, _Bool LinesOnTheSides, uint8_t colorBox, uint8_t colorLinesOnTheSide);
53 54
54 void t7_tissues(const SDiveState * pState); 55 void t7_tissues(const SDiveState * pState);
55 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading); 56 void t7_compass(uint16_t ActualHeading, uint16_t UserSetHeading);
1489 enabledViewCnt += increment; 1490 enabledViewCnt += increment;
1490 } 1491 }
1491 return enabledViewCnt; 1492 return enabledViewCnt;
1492 } 1493 }
1493 1494
1495 uint8_t t7_customview_disabled(uint8_t view)
1496 {
1497 uint8_t i = 0;
1498 uint8_t cv_disabled = 0;
1499
1500 while(cv_changelist[i] != CVIEW_END)
1501 {
1502 if((view == cv_changelist[i]) && !CHECK_BIT_THOME(settingsGetPointer()->cv_configuration, cv_changelist[i]))
1503 {
1504 cv_disabled = 1;
1505 break;
1506 }
1507 i++;
1508 }
1509
1510 if (((view == CVIEW_sensors) || (view == CVIEW_sensors_mV)) &&
1511 ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0)))
1512 {
1513 cv_disabled = 1;
1514 }
1515 return cv_disabled;
1516 }
1517
1494 void t7_change_customview(uint8_t action) 1518 void t7_change_customview(uint8_t action)
1495 { 1519 {
1496 int8_t i;
1497 uint8_t *pViews; 1520 uint8_t *pViews;
1498 uint8_t *pStartView,*pCurView, *pLastView; 1521 uint8_t *pStartView,*pCurView, *pLastView;
1499 _Bool cv_disabled = 0; 1522 _Bool cv_disabled = 0;
1500 1523
1501 if(stateUsed->mode == MODE_DIVE) 1524 if(stateUsed->mode == MODE_DIVE)
1538 } 1561 }
1539 } 1562 }
1540 1563
1541 do 1564 do
1542 { 1565 {
1543 cv_disabled = 0; 1566 cv_disabled = t7_customview_disabled(*pViews);
1544 i=0;
1545 while(cv_changelist[i] != CVIEW_END)
1546 {
1547 if((*pViews == cv_changelist[i]) && !CHECK_BIT_THOME(settingsGetPointer()->cv_configuration, cv_changelist[i]))
1548 {
1549 cv_disabled = 1;
1550 break;
1551 }
1552 i++;
1553 }
1554
1555 if (((*pViews == CVIEW_sensors) || (*pViews == CVIEW_sensors_mV)) &&
1556 ((stateUsed->diveSettings.ppo2sensors_deactivated) || (stateUsed->diveSettings.ccrOption == 0)))
1557 {
1558 cv_disabled = 1;
1559 }
1560
1561 if(cv_disabled) /* view is disabled => jump to next view */ 1567 if(cv_disabled) /* view is disabled => jump to next view */
1562 { 1568 {
1563 if((action == ACTION_BUTTON_ENTER) || (action == ACTION_PITCH_POS)) 1569 if((action == ACTION_BUTTON_ENTER) || (action == ACTION_PITCH_POS))
1564 { 1570 {
1565 pViews++; 1571 pViews++;
1596 } 1602 }
1597 1603
1598 1604
1599 void t7_refresh_customview(void) 1605 void t7_refresh_customview(void)
1600 { 1606 {
1607 static uint8_t last_customview = CVIEW_END;
1601 1608
1602 char text[256]; 1609 char text[256];
1603 uint16_t textpointer = 0; 1610 uint16_t textpointer = 0;
1604 int16_t start; 1611 int16_t start;
1605 uint8_t lineCountCustomtext = 0; 1612 uint8_t lineCountCustomtext = 0;
1612 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime 1619 float depth, surface, fraction_nitrogen, fraction_helium, ead, end; // CVIEW_EADTime
1613 1620
1614 SSettings* pSettings; 1621 SSettings* pSettings;
1615 pSettings = settingsGetPointer(); 1622 pSettings = settingsGetPointer();
1616 1623
1617 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) 1624 if(last_customview != selection_customview) /* check if current selection is disabled and should be skipped */
1618 t7_change_customview(ACTION_BUTTON_ENTER); 1625 {
1619 if((selection_customview == CVIEW_sensors_mV) &&(stateUsed->diveSettings.ccrOption == 0)) 1626 if(t7_customview_disabled(selection_customview))
1620 t7_change_customview(ACTION_BUTTON_ENTER); 1627 {
1621 if((selection_customview == CVIEW_sensors) &&(stateUsed->diveSettings.ccrOption == 0)) 1628 t7_change_customview(ACTION_BUTTON_ENTER);
1622 t7_change_customview(ACTION_BUTTON_ENTER); 1629 }
1623 1630 }
1624 switch(selection_customview) 1631 switch(selection_customview)
1625 { 1632 {
1626 case CVIEW_noneOrDebug: 1633 case CVIEW_noneOrDebug:
1627 if(settingsGetPointer()->showDebugInfo) 1634 if(settingsGetPointer()->showDebugInfo)
1628 { 1635 {