Mercurial > public > ostc4
changeset 351:ba53ab77f059
Merge
author | heinrichsweikamp |
---|---|
date | Sun, 06 Oct 2019 14:12:41 +0200 |
parents | 591c03a1e68d (current diff) 607099140a41 (diff) |
children | 1f24022345d1 5f46ec49f9bf |
files | RefPrj/Firmware/.cproject RefPrj/RTE/.cproject Small_CPU/Src/pressure.c ostc4pack/OSTC4_Firmware.bin ostc4pack/OSTC4_firmware_upload.bin |
diffstat | 17 files changed, 132 insertions(+), 372 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Inc/tStructure.h Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Inc/tStructure.h Sun Oct 06 14:12:41 2019 +0200 @@ -123,7 +123,6 @@ #define StMOG_ChangeDepth _MB(2,1,255,3,0) #define StMOG_SetToMOD _MB(2,1,255,4,0) #define StMOG_Bottle _MB(2,1,255,5,0) -#define StMOG_Wireless _MB(2,1,255,6,0) #define StMOG_MOD _MB(2,1,255,9,0)
--- a/Discovery/Inc/text_multilanguage.h Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Inc/text_multilanguage.h Sun Oct 06 14:12:41 2019 +0200 @@ -166,6 +166,7 @@ TXT2BYTE_ResetStopwatch, TXT2BYTE_SetMarker, TXT2BYTE_CompassHeading, + TXT2BYTE_EndDiveMode, /* */ TXT2BYTE_Simulator, TXT2BYTE_StartSimulator, @@ -237,8 +238,6 @@ TXT2BYTE_AmbientTemperature, /* */ TXT2BYTE_Bottle, - TXT2BYTE_WirelessSender, - TXT2BYTE_WirelessDisconnect, /* */ TXT2BYTE_Gaslist, TXT2BYTE_Clock,
--- a/Discovery/Src/base.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/base.c Sun Oct 06 14:12:41 2019 +0200 @@ -525,6 +525,8 @@ /// to be called /// // =============================================================================== + +//#define NO_TIMEOUT void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) { #ifdef DEMOMODE
--- a/Discovery/Src/data_exchange_main.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/data_exchange_main.c Sun Oct 06 14:12:41 2019 +0200 @@ -693,40 +693,31 @@ } } -#define AVERAGE_COUNT 4 static float getSampleDepth(SDataExchangeSlaveToMaster *d, SDiveState *ds) { - static uint8_t c = 0; - static float ambient[AVERAGE_COUNT] = {0}; - static float surface[AVERAGE_COUNT]= {0}; - static float depth[AVERAGE_COUNT]= {0}; - - ambient[c] = d->data[d->boolPressureData].pressure_mbar / 1000.0f; - surface[c] = d->data[d->boolPressureData].surface_mbar / 1000.0f; - float density = ((float)( 100 + settingsGetPointer()->salinity)) / 100.0f; + float ambient = 0; + float surface = 0; + float depth = 0; + float density = 0; - ds->lifeData.pressure_ambient_bar = (ambient[0] + ambient[1] + ambient[2] + ambient[3])/4.0f; - ds->lifeData.pressure_surface_bar = (surface[0] + surface[1] + surface[2] + surface[3])/4.0f; - depth[c] = (ambient[c] - surface[c]) / (0.09807f * density); + ambient = d->data[d->boolPressureData].pressure_mbar / 1000.0f; + surface = d->data[d->boolPressureData].surface_mbar / 1000.0f; + density = ((float)( 100 + settingsGetPointer()->salinity)) / 100.0f; - c++; - if (c == AVERAGE_COUNT) c = 0; + ds->lifeData.pressure_ambient_bar = ambient; + ds->lifeData.pressure_surface_bar = surface; + depth = (ambient - surface) / (0.09807f * density); + ds->lifeData.bool_temp1 = d->data[d->boolPressureData].SPARE1; - return (depth[0] + depth[1] + depth[2] + depth[3])/4.0f; + return depth; } -#define TEMP_AVERAGE_COUNT 3 static float getTemperature(SDataExchangeSlaveToMaster *d) { - static uint8_t c = 0; - static float temp[TEMP_AVERAGE_COUNT] = {0}; - - temp[c] = d->data[d->boolPressureData].temperature; + float temp = 0; + temp = d->data[d->boolPressureData].temperature; - c++; - if (c == TEMP_AVERAGE_COUNT) c = 0; - - return (temp[0] + temp[1] + temp[2])/3.0f; + return temp; } void DataEX_copy_to_LifeData(_Bool *modeChangeFlag)
--- a/Discovery/Src/t7.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/t7.c Sun Oct 06 14:12:41 2019 +0200 @@ -1144,73 +1144,8 @@ draw_frame(0,0, CLUT_pluginboxSurface, CLUT_Font020); } -void t7_refresh_surface_debugmode_wireless_info(void) -{ - char text[400]; - uint8_t colorDataLost = 0; - int txtPointer = 0; - uint8_t numberOfBytes = 0; - - GFX_DrawCfgWindow textWindow = - { - .Image = &t7screen, - .WindowNumberOfTextLines = 5, - .WindowLineSpacing = 70, - .WindowTab = 220, - .WindowX0 = 10, - .WindowX1 = 790, - .WindowY0 = 10, - .WindowY1 = 380 - }; - - Gfx_write_label_var(&t7screen, 10,600, 10,&FontT42,CLUT_DiveMainLabel,"Wireless Data"); - - if(stateUsed->data_old__lost_connection_to_slave) - { - Gfx_write_label_var(&t7screen, 600,800,10,&FontT42,CLUT_Font020,"CPU2?"); - colorDataLost = 1; - } - - txtPointer = 0; - for(int i=0;i<4;i++) - { - if((!stateUsed->lifeData.wireless_data[i].ageInMilliSeconds) || colorDataLost) - text[txtPointer++] = '\021'; - - numberOfBytes = stateUsed->lifeData.wireless_data[i].numberOfBytes; - if((numberOfBytes > 0) && (numberOfBytes <= 10)) - { - txtPointer += snprintf(&text[txtPointer],20,"%02u s %02u\t" - ,(stateUsed->lifeData.wireless_data[i].ageInMilliSeconds)/1000 - ,stateUsed->lifeData.wireless_data[i].status - ); - if(numberOfBytes > 8) ///< lifeData.wireless_data[i].data[j] has only size of 8 - numberOfBytes = 8; - for(int j=0;j<numberOfBytes;j++) - { - txtPointer += snprintf(&text[txtPointer],4," %02X" - ,stateUsed->lifeData.wireless_data[i].data[j] - ); - } - } - text[txtPointer++] = '\n'; - text[txtPointer++] = '\r'; - text[txtPointer++] = '\020'; - text[txtPointer] = 0; - } - GFX_write_string(&FontT48,&textWindow,text,1); - -} - - void t7_refresh_surface_debugmode(void) { - if(selection_customview%2 == 1) - { - t7_refresh_surface_debugmode_wireless_info(); - return; - } - // could be warning, now just to set RTE variables DataEX_check_RTE_version__needs_update(); @@ -1312,6 +1247,16 @@ // Gfx_write_label_var(&t7screen, 601,800,310,&FontT42,CLUT_DiveMainLabel,"Light"); // Gfx_write_label_var(&t7screen, 601,800,355,&FontT48,CLUT_Font020,TextL1); +/* show surface pressure state */ + if(stateUsed->lifeData.bool_temp1 ) + { + snprintf(TextL1,TEXTSIZE,"stable"); + } + else + { + snprintf(TextL1,TEXTSIZE,"unstable"); + } + Gfx_write_label_var(&t7screen, 500,800,400,&FontT48,CLUT_Font020,TextL1); if(Sdate.Year < 15)
--- a/Discovery/Src/tMenuEditGasOC.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/tMenuEditGasOC.c Sun Oct 06 14:12:41 2019 +0200 @@ -44,19 +44,15 @@ uint8_t setpoint; } SEditGasPage; -#define MAX_SENDER_AT_ONCE 5 /* Private variables ---------------------------------------------------------*/ SEditGasPage editGasPage; -uint16_t wirelessSender[MAX_SENDER_AT_ONCE]; - /* Private function prototypes -----------------------------------------------*/ void create_text_with_u8(char *text, const char *text1, uint8_t inputU8, const char *text2); void openEdit_Gas(uint8_t line, uint8_t ccr); void openEdit_GasType(void); -void openEdit_Wireless(void); void openEdit_DiveGasSelect(uint8_t line, uint8_t ccr); void openEdit_SpecialDiveGasMenu(uint8_t ccr); @@ -70,16 +66,12 @@ uint8_t OnAction_ChangeDepth (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_SetToMOD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_BottleSize (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); -uint8_t OnAction_Wireless (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_First (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_Deco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_Travel (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_Inactive (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); -uint8_t OnAction_WirelessID (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); -uint8_t OnAction_NoWireless (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); - uint8_t OnAction_DM_Active (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); uint8_t OnAction_DM_Mix (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); @@ -344,8 +336,7 @@ /* surface mode */ void openEdit_Gas(uint8_t line, uint8_t ccr) { - uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive;//, bottleSizeLiter;, bottleWirelessStatus; - //uint16_t bottleWirelessId;//, bottleWirelessIdSmall; + uint8_t gasID, oxygen, helium, depthDeco, active, first, depthMOD, deco, travel, inactive;//, bottleSizeLiter; char text[32]; char textMOD[32]; @@ -385,9 +376,6 @@ travel = editGasPage.pGasLine[gasID].note.ub.travel; //bottleSizeLiter = editGasPage.pGasLine[gasID].bottle_size_liter; -// bottleWirelessStatus = editGasPage.pGasLine[gasID].bottle_wireless_status; - //bottleWirelessId = editGasPage.pGasLine[gasID].bottle_wireless_id; - //bottleWirelessIdSmall = bottleWirelessId & 0x0F; if(active) inactive = 0; @@ -487,14 +475,6 @@ write_label_var( 20 ,800, ME_Y_LINE5, &FontT48, text); write_field_2digit(StMOG_Bottle, 600, 710, ME_Y_LINE5, &FontT48,"## ltr", (uint32_t)bottleSizeLiter, 0, 0, 0); - txtptr = 0; - text[txtptr++] = TXT_2BYTE; - text[txtptr++] = TXT2BYTE_WirelessSender; - text[txtptr++] = ' '; - if(!bottleWirelessId) - text[txtptr++] = '\021'; - txtptr += snprintf(&text[txtptr],20,"%u (%04X)",bottleWirelessIdSmall, bottleWirelessId); - write_field_button(StMOG_Wireless, 20, 710, ME_Y_LINE6, &FontT48, text); */ stop_cursor_fields(); @@ -522,7 +502,6 @@ } /* setEvent(StMOG_Bottle, (uint32_t)OnAction_BottleSize); - setEvent(StMOG_Wireless, (uint32_t)OnAction_Wireless); */ write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); } @@ -606,205 +585,6 @@ return UNSPECIFIC_RETURN; } -void openEdit_Wireless(void) -{ - uint8_t gasID, wirelessSenderAvailable, isNotMatched, isMatchedWithThis, wirelessSenderActive[MAX_SENDER_AT_ONCE], senderCount, isInList; //, wirelessStatus; - uint16_t wirelessId, wirelessSenderIdSmall, wirelessIdTemp; - char text[32]; - uint8_t txtptr; - - if(editGasPage.ccr) - { - resetMenuEdit(CLUT_MenuPageGasCC); - setBackMenu((uint32_t)openEdit_GasCC, editGasPage.gasID - NUM_OFFSET_DILUENT, 5); - } - else - { - resetMenuEdit(CLUT_MenuPageGasOC); - setBackMenu((uint32_t)openEdit_GasOC, editGasPage.gasID, 5); - } - - gasID = editGasPage.gasID; - wirelessId = editGasPage.pGasLine[gasID].bottle_wireless_id; -// wirelessStatus = editGasPage.pGasLine[gasID].bottle_wireless_status; - - - /* header */ - int i = 0; - if(gasID >= 10) - { - i = 1; - strcpy(text, "\001" "Gas #10 X"); - } - else - strcpy(text, "\001" "Gas #0 X"); - - if(editGasPage.ccr) - text[8+i] = TXT_Diluent_Gas_Edit; - else - text[8+i] = TXT_OC_Gas_Edit; - - if(gasID >= 10) - text[6+i] += gasID - 10; - else - text[6+i] += gasID; - write_topline(text); - - senderCount = 0; - wirelessSenderAvailable = 0; - if(wirelessId) - { - wirelessSender[senderCount] = wirelessId; - wirelessSenderActive[senderCount] = 0; - wirelessSenderAvailable++; - senderCount++; - } - - for(int i=0;i<4;i++) - { - if((stateUsed->lifeData.wireless_data[i].ageInMilliSeconds) && (stateUsed->lifeData.wireless_data[i].ageInMilliSeconds <= 60000) && ((stateUsed->lifeData.wireless_data[i].data[1] & 0x0F) != 0)) - { - wirelessIdTemp = stateUsed->lifeData.wireless_data[i].data[0] * 256; - wirelessIdTemp += stateUsed->lifeData.wireless_data[i].data[1]; - if(wirelessId && (wirelessId == wirelessIdTemp)) - wirelessSenderActive[0] = 1; - else - { - isInList = 0; - for(int j=0;j<wirelessSenderAvailable;j++) - { - if(wirelessSender[j] == wirelessIdTemp) - { - isInList = 1; - break; - } - } - if(!isInList) - { - wirelessSender[senderCount] = wirelessIdTemp; - wirelessSenderActive[senderCount] = 1; - wirelessSenderAvailable++; - senderCount++; - } - } - } - } - - if(wirelessSenderAvailable > MAX_SENDER_AT_ONCE) - wirelessSenderAvailable = MAX_SENDER_AT_ONCE; - - isNotMatched = 1; - - for(int i=0;i<wirelessSenderAvailable;i++) - { - wirelessSenderIdSmall = wirelessSender[i] & 0x0F; - - txtptr = 0; - if(!wirelessSenderActive[i]) - text[txtptr++] = '\021'; - txtptr += snprintf(&text[txtptr],10,"%u (%04X)",wirelessSenderIdSmall, wirelessSender[i]); - - if(wirelessId == wirelessSender[i]) - { - isMatchedWithThis = 1; - isNotMatched = 0; - } - else - { - isMatchedWithThis = 0; - for(int j=1; j <= 2*NUM_GASES; j++) - { - if((gasID != j) && (settingsGetPointer()->gas[j].bottle_wireless_id == wirelessSender[i])) - { - txtptr += snprintf(&text[txtptr],20," used by Gas #%i",i); - break; - } - } - } - write_field_on_off(StMOG_Transmitter1 + i, 30, 710, ME_Y_LINE1 + (i * ME_Y_LINE_STEP), &FontT48, text, isMatchedWithThis); - } - - - txtptr = 0; - text[txtptr++] = TXT_2BYTE; - text[txtptr++] = TXT2BYTE_WirelessDisconnect; - text[txtptr++] = 0; - write_field_on_off(StMOG_NoTransmitter, 30, 400, ME_Y_LINE6, &FontT48, text, isNotMatched); - - // setEvent has to be _after_ all fields are written - for(int i=0;i<wirelessSenderAvailable;i++) - setEvent(StMOG_Transmitter1 + i, (uint32_t)OnAction_WirelessID); - - setEvent(StMOG_NoTransmitter, (uint32_t)OnAction_NoWireless); -} - - -uint8_t OnAction_Wireless(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) -{ - openEdit_Wireless(); - return UNSPECIFIC_RETURN; -} - - -uint8_t OnAction_WirelessID (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) -{ - if((editId < StMOG_Transmitter1) || (editId > StMOG_Transmitter5)) - return UNSPECIFIC_RETURN; - - uint8_t line, isMatched; - - line = editId - StMOG_Transmitter1; - - - if(editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id == wirelessSender[line]) - isMatched = 1; - else - isMatched = 0; - - editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id = wirelessSender[line]; -// editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_status = 0; - - for(int i=0;i<5;i++) - { - if((StMOG_Transmitter1 + i) != editId) - tMenuEdit_set_on_off(StMOG_Transmitter1 + i, 0); - } - tMenuEdit_set_on_off(editId, 1); - tMenuEdit_set_on_off(StMOG_NoTransmitter, 0); - - if(!isMatched) - return UPDATE_DIVESETTINGS; - else - return UPDATE_AND_EXIT_TO_MENU; -} - - -uint8_t OnAction_NoWireless (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) -{ - uint8_t isNotMatched; - - if(editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id == 0) - isNotMatched = 1; - else - isNotMatched = 1; - - editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_id = 0; -// editGasPage.pGasLine[editGasPage.gasID].bottle_wireless_status = 0; - - tMenuEdit_set_on_off(StMOG_Transmitter1, 0); - tMenuEdit_set_on_off(StMOG_Transmitter2, 0); - tMenuEdit_set_on_off(StMOG_Transmitter3, 0); - tMenuEdit_set_on_off(StMOG_Transmitter4, 0); - tMenuEdit_set_on_off(StMOG_Transmitter5, 0); - tMenuEdit_set_on_off(StMOG_NoTransmitter, 1); - - if(!isNotMatched) - return UPDATE_DIVESETTINGS; - else - return UPDATE_AND_EXIT_TO_MENU; -} - - uint8_t OnAction_Mix(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) { uint8_t digitContentNew;
--- a/Discovery/Src/tMenuEditSystem.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/tMenuEditSystem.c Sun Oct 06 14:12:41 2019 +0200 @@ -35,11 +35,16 @@ #include "ostc.h" #include "settings.h" // for getLicence() #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() +#include "tMenu.h" #include "tMenuEdit.h" +#include "tMenuSystem.h" +#include "t7.h" + +/* uncomment to activate debug view option */ +/*#define HAVE_DEBUG_VIEW */ /* Private variables ---------------------------------------------------------*/ - -uint8_t infoPage = 0; +static uint8_t infoPage = 0; /* Private function prototypes -----------------------------------------------*/ void openEdit_DateTime(void); @@ -576,10 +581,14 @@ write_field_button(StMSYS3_Units, 400, 700, ME_Y_LINE1, &FontT48, ""); write_field_button(StMSYS3_Colors, 400, 700, ME_Y_LINE2, &FontT48, ""); -// write_field_button(StMSYS3_Debug, 400, 700, ME_Y_LINE3, &FontT48, ""); +#ifdef HAVE_DEBUG_VIEW + write_field_button(StMSYS3_Debug, 400, 700, ME_Y_LINE3, &FontT48, ""); +#endif setEvent(StMSYS3_Units, (uint32_t)OnAction_Units); setEvent(StMSYS3_Colors, (uint32_t)OnAction_Colorscheme); -// setEvent(StMSYS3_Debug, (uint32_t)OnAction_DebugInfo); +#ifdef HAVE_DEBUG_VIEW + setEvent(StMSYS3_Debug, (uint32_t)OnAction_DebugInfo); +#endif } @@ -620,7 +629,7 @@ text[1] = 0; write_label_var( 400, 700, ME_Y_LINE2, &FontT48, text); -/* +#ifdef HAVE_DEBUG_VIEW // specials text[0] = TXT_2BYTE; text[1] = TXT2BYTE_ShowDebug; @@ -633,7 +642,7 @@ text[0] = '\006'; text[1] = 0; write_label_var( 400, 700, ME_Y_LINE3, &FontT48, text); -*/ +#endif // design text[0] = TXT_Depth; @@ -732,7 +741,7 @@ write_field_button(StMSYS4_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, ""); write_field_button(StMSYS4_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); - write_field_button(StMSYS4_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); + write_field_button(StMSYS4_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); write_field_button(StMSYS4_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, "");
--- a/Discovery/Src/tMenuEditXtra.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/tMenuEditXtra.c Sun Oct 06 14:12:41 2019 +0200 @@ -33,12 +33,15 @@ #include "simulation.h" #include "timer.h" #include "tMenuEdit.h" +#include "data_exchange_main.h" + /* Private function prototypes -----------------------------------------------*/ void openEdit_CompassHeading(void); void openEdit_ResetStopwatch(void); void openEdit_SimFollowDecostops(void); void openEdit_SetManualMarker(void); +void openEdit_SetEndDive(void); /* Announced function prototypes -----------------------------------------------*/ uint8_t OnAction_CompassHeading (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); @@ -63,7 +66,14 @@ openEdit_SetManualMarker(); break; case 4: - openEdit_SimFollowDecostops(); + if(is_stateUsedSetToSim()) + { + openEdit_SimFollowDecostops(); + } + else + { + openEdit_SetEndDive(); + } break; } } @@ -81,6 +91,12 @@ exitMenuEdit_to_Home(); } +void openEdit_SetEndDive(void) +{ + dataOutGetPointer()->setEndDive = 1; + exitMenuEdit_to_Home(); +} + void openEdit_SimFollowDecostops(void) { simulation_set_heed_decostops(!simulation_get_heed_decostops());
--- a/Discovery/Src/tMenuGas.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/tMenuGas.c Sun Oct 06 14:12:41 2019 +0200 @@ -74,7 +74,7 @@ { const SGasLine * pGasLine; - uint8_t gasId, oxygen, helium, depthUp, active, first, typeDeco, wirelessId; + uint8_t gasId, oxygen, helium, depthUp, active, first, typeDeco; float fPpO2limitHigh = 0; float fPpO2ofGasAtThisDepth = 0; //uint8_t senderCode, depthDown,; @@ -142,7 +142,6 @@ typeDeco = pGasLine[gasId].note.ub.deco; mod = calc_MOD(gasId); ltr = pGasLine[gasId].bottle_size_liter; - wirelessId = pGasLine[gasId].bottle_wireless_id; //bar = stateUsed->lifeData.bottle_bar[gasId]; if(active) @@ -224,12 +223,6 @@ if(ltr) color[2] = '\020'; /* bar */ - if(wirelessId) - color[3] = '\020'; - /* wireless */ - if(wirelessId) - color[4] = '\020'; - /* ltr, bar */ if(mod < depthUp) { @@ -302,18 +295,6 @@ color[3], bar ); */ - /* wireless */ -/* - if(wirelessId) - { - textPointer += snprintf(&text[textPointer], 8,\ - "%c" - " *" - "%u", - color[4], (wirelessId%0x0F) - ); - } -*/ text[textPointer++] = '\035'; text[textPointer++] = '\n'; text[textPointer++] = '\r';
--- a/Discovery/Src/tMenuXtra.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/tMenuXtra.c Sun Oct 06 14:12:41 2019 +0200 @@ -94,6 +94,16 @@ strcpy(&text[textPointer],"\n\r"); textPointer += 2; } + else + { + if((line == 0) || (line == 4)) /* end dive mode only used during real dives */ + { + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_EndDiveMode; + } + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; + } return StMXTRA; }
--- a/Discovery/Src/text_multilanguage.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Discovery/Src/text_multilanguage.c Sun Oct 06 14:12:41 2019 +0200 @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// /// -*- coding: UTF-8 -*- /// /// \file Discovery/Src/text_multilanguage.c @@ -722,6 +722,13 @@ static uint8_t text_IT_CompassHeading[] = "Direzione bussola"; static uint8_t text_ES_CompassHeading[] = "Rumbo brújula"; +// Dive Menu +static uint8_t text_EN_EndDiveMode[] = "End dive"; +static uint8_t text_DE_EndDiveMode[] = "Tauchgang beenden"; +static uint8_t text_FR_EndDiveMode[] = "End dive"; +static uint8_t text_IT_EndDiveMode[] = "End dive"; +static uint8_t text_ES_EndDiveMode[] = "End dive"; + // Menu SIM static uint8_t text_EN_Simulator[] = "Simulator"; static uint8_t text_DE_Simulator[] = ""; @@ -1505,18 +1512,6 @@ static uint8_t text_IT_GasVorrat[] = ""; static uint8_t text_ES_GasVorrat[] = ""; -static uint8_t text_EN_WirelessSender[] = "wireless id"; -static uint8_t text_DE_WirelessSender[] = "Sender ID"; -static uint8_t text_FR_WirelessSender[] = ""; -static uint8_t text_IT_WirelessSender[] = "Numero di serie"; -static uint8_t text_ES_WirelessSender[] = "wireless id"; - -static uint8_t text_EN_WirelessDisconnect[] = "Disconnect"; -static uint8_t text_DE_WirelessDisconnect[] = "Nicht verbunden"; -static uint8_t text_FR_WirelessDisconnect[] = ""; -static uint8_t text_IT_WirelessDisconnect[] = "Disconnesso"; -static uint8_t text_ES_WirelessDisconnect[] = "Desconectado"; - static uint8_t text_EN_FlipDisplay[] = "Flip display"; static uint8_t text_DE_FlipDisplay[] = "Anzeige spiegeln"; static uint8_t text_FR_FlipDisplay[] = ""; @@ -1622,7 +1617,8 @@ {(uint8_t)TXT2BYTE_ResetStopwatch, {text_EN_ResetStopwatch, text_DE_ResetStopwatch, text_FR_ResetStopwatch, text_IT_ResetStopwatch, text_ES_ResetStopwatch}}, {(uint8_t)TXT2BYTE_SetMarker, {text_EN_SetMarker, text_DE_SetMarker, text_FR_SetMarker, text_IT_SetMarker, text_ES_SetMarker}}, {(uint8_t)TXT2BYTE_CompassHeading, {text_EN_CompassHeading, text_DE_CompassHeading, text_FR_CompassHeading, text_IT_CompassHeading, text_ES_CompassHeading}}, - {(uint8_t)TXT2BYTE_Simulator, {text_EN_Simulator, text_DE_Simulator, text_FR_Simulator, text_IT_Simulator, text_ES_Simulator}}, + {(uint8_t)TXT2BYTE_EndDiveMode, {text_EN_EndDiveMode, text_DE_EndDiveMode, text_FR_EndDiveMode, text_IT_EndDiveMode, text_ES_EndDiveMode}}, + {(uint8_t)TXT2BYTE_Simulator, {text_EN_Simulator, text_DE_Simulator, text_FR_Simulator, text_IT_Simulator, text_ES_Simulator}}, {(uint8_t)TXT2BYTE_StartSimulator, {text_EN_StartSimulator, text_DE_StartSimulator, text_FR_StartSimulator, text_IT_StartSimulator, text_ES_StartSimulator}}, {(uint8_t)TXT2BYTE_Intervall, {text_EN_Intervall, text_DE_Intervall, text_FR_Intervall, text_IT_Intervall, text_ES_Intervall}}, {(uint8_t)TXT2BYTE_SimDiveTime, {text_EN_SimDiveTime, text_DE_SimDiveTime, text_FR_SimDiveTime, text_IT_SimDiveTime, text_ES_SimDiveTime}}, @@ -1684,8 +1680,6 @@ {(uint8_t)TXT2BYTE_NumberOfDives, {text_EN_NumberOfDives, text_DE_NumberOfDives, text_FR_NumberOfDives, text_IT_NumberOfDives, text_ES_NumberOfDives}}, {(uint8_t)TXT2BYTE_AmbientTemperature,{text_EN_AmbientTemperature, text_DE_AmbientTemperature, text_FR_AmbientTemperature, text_IT_AmbientTemperature, text_ES_AmbientTemperature}}, {(uint8_t)TXT2BYTE_Bottle, {text_EN_Bottle, text_DE_Bottle, text_FR_Bottle, text_IT_Bottle, text_ES_Bottle}}, - {(uint8_t)TXT2BYTE_WirelessSender,{text_EN_WirelessSender, text_DE_WirelessSender, text_FR_WirelessSender, text_IT_WirelessSender, text_ES_WirelessSender}}, - {(uint8_t)TXT2BYTE_WirelessDisconnect,{text_EN_WirelessDisconnect, text_DE_WirelessDisconnect, text_FR_WirelessDisconnect, text_IT_WirelessDisconnect, text_ES_WirelessDisconnect}}, {(uint8_t)TXT2BYTE_Gaslist, {text_EN_Gaslist, text_DE_Gaslist, text_FR_Gaslist, text_IT_Gaslist, text_ES_Gaslist}}, {(uint8_t)TXT2BYTE_Clock, {text_EN_Clock, text_DE_Clock, text_FR_Clock, text_IT_Clock, text_ES_Clock}}, {(uint8_t)TXT2BYTE_Sunday, {text_EN_Sunday, text_DE_Sunday, text_FR_Sunday, text_IT_Sunday, text_ES_Sunday}},
--- a/RefPrj/Firmware/.cproject Sun Oct 06 14:07:51 2019 +0200 +++ b/RefPrj/Firmware/.cproject Sun Oct 06 14:12:41 2019 +0200 @@ -50,7 +50,7 @@ <option id="gnu.cpp.compiler.option.debugging.level.1733485526" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/> </tool> <tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1908756987" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"> - <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1377166494" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}\..\ostc4\Common\CPU1-F429.ld" valueType="string"/> + <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.1377166494" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="C:\Users\mh\workspace\ostc4\Common\CPU1-F429.ld" valueType="string"/> <option id="gnu.c.link.option.ldflags.1166539479" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="-u _printf_float " valueType="string"/> <option id="gnu.c.link.option.other.2080432652" name="Other options (-Xlinker [option])" superClass="gnu.c.link.option.other" useByScannerDiscovery="false"/> <option id="gnu.c.link.option.paths.1365621909" name="Library search path (-L)" superClass="gnu.c.link.option.paths" useByScannerDiscovery="false"/> @@ -115,7 +115,7 @@ </extensions> </storageModule> <storageModule moduleId="cdtBuildSystem" version="4.0.0"> - <configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1554475450" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -R .upper* -R .font_firmware_data -O binary "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin"; arm-none-eabi-size "${BuildArtifactFileName}""> + <configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1554475450" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -R .upper* -O binary "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin"; arm-none-eabi-size "${BuildArtifactFileName}""> <folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1554475450." name="/" resourcePath=""> <toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release.240202493" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release"> <option id="fr.ac6.managedbuild.option.gnu.cross.mcu.1492720020" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" useByScannerDiscovery="false" value="STM32F429IITx" valueType="string"/> @@ -151,7 +151,7 @@ <option id="gnu.cpp.compiler.option.debugging.level.1273410642" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> </tool> <tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1139299269" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"> - <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.920748377" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}\..\ostc4\Common\CPU1-F429.ld" valueType="string"/> + <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.920748377" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="C:\Users\mh\workspace\ostc4\Common\CPU1-F429.ld" valueType="string"/> <option id="gnu.c.link.option.strip.1057056433" name="Omit all symbol information (-s)" superClass="gnu.c.link.option.strip" useByScannerDiscovery="false" value="false" valueType="boolean"/> <option id="gnu.c.link.option.ldflags.1124840583" name="Linker flags" superClass="gnu.c.link.option.ldflags" useByScannerDiscovery="false" value="-u _printf_float" valueType="string"/> <option id="gnu.c.link.option.nostart.543218958" name="Do not use standard start files (-nostartfiles)" superClass="gnu.c.link.option.nostart" useByScannerDiscovery="false" value="false" valueType="boolean"/>
--- a/RefPrj/RTE/.cproject Sun Oct 06 14:07:51 2019 +0200 +++ b/RefPrj/RTE/.cproject Sun Oct 06 14:12:41 2019 +0200 @@ -117,7 +117,7 @@ <option id="gnu.cpp.compiler.option.debugging.level.1980132124" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/> </tool> <tool id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.1224776758" name="MCU GCC Linker" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker"> - <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.477531566" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="${ProjDirPath}\..\ostc4\Small_CPU\CPU2-RTE.ld" valueType="string"/> + <option id="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script.477531566" name="Linker Script (-T)" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.linker.script" useByScannerDiscovery="false" value="C:\Users\mh\workspace\ostc4\Small_CPU\CPU2-RTE.ld" valueType="string"/> <option id="gnu.c.link.option.nodeflibs.1006660034" name="Do not use default libraries (-nodefaultlibs)" superClass="gnu.c.link.option.nodeflibs" useByScannerDiscovery="false" value="false" valueType="boolean"/> <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1337752943" superClass="cdt.managedbuild.tool.gnu.c.linker.input"> <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
--- a/Small_CPU/Inc/pressure.h Sun Oct 06 14:07:51 2019 +0200 +++ b/Small_CPU/Inc/pressure.h Sun Oct 06 14:12:41 2019 +0200 @@ -20,6 +20,9 @@ float get_pressure_mbar(void); float get_surface_mbar(void); +uint8_t is_surface_pressure_stable(void); +float set_last_surface_pressure_stable(void); + void init_surface_ring(uint8_t force); void update_surface_pressure(uint8_t call_rhythm_seconds);
--- a/Small_CPU/Src/scheduler.c Sun Oct 06 14:07:51 2019 +0200 +++ b/Small_CPU/Src/scheduler.c Sun Oct 06 14:12:41 2019 +0200 @@ -57,6 +57,8 @@ uint8_t deviceDataSubSeconds = 0; /* Private variables ---------------------------------------------------------*/ +static uint16_t ManualExitDiveCounter = 0; /* The computer will exit dive mode in shallow area immediately. Increase depth to restart dive while counter is active */ + /* can be lost while in sleep */ uint8_t clearDecoNow = 0; uint8_t setButtonsNow = 0; @@ -262,6 +264,11 @@ } } + if(global.dataSendToSlave.setEndDive) + { + ManualExitDiveCounter = 30 * 60; /* This will cause the computer to leave dive mode if in shallow area and increase the depth to enter dive mode for the next 30 minutes */ + } + if((global.mode == MODE_SURFACE) && (global.dataSendToSlave.mode == MODE_SHUTDOWN)) { global.mode = MODE_SHUTDOWN; @@ -461,6 +468,14 @@ scheduleSetDate(&global.deviceData.diveCycles); global.lifeData.counterSecondsShallowDepth = 0; + /* Get the last stable value in case of an unstable surface history condition */ + if(!is_surface_pressure_stable()) + { + set_last_surface_pressure_stable(); + } + global.lifeData.pressure_surface_bar = get_surface_mbar() / 1000.0f; + ManualExitDiveCounter = 0; /* reset early exit request */ + Scheduler.tickstart = HAL_GetTick(); while(global.mode == MODE_DIVE) { @@ -556,11 +571,12 @@ global.demo_mode = 0; } } - + if(is_ambient_pressure_close_to_surface(&global.lifeData)) { global.lifeData.counterSecondsShallowDepth++; - if((global.lifeData.counterSecondsShallowDepth >= global.settings.timeoutDiveReachedZeroDepth) || ((global.lifeData.dive_time_seconds < 60) && (global.demo_mode == 0)) || (global.dataSendToSlave.setEndDive)) + if((global.lifeData.counterSecondsShallowDepth >= global.settings.timeoutDiveReachedZeroDepth) || ((global.lifeData.dive_time_seconds < 60) && (global.demo_mode == 0)) + || (ManualExitDiveCounter)) { global.seconds_since_last_dive = 1; // start counter schedule_update_timer_helper(0); // zum starten :-) @@ -600,7 +616,7 @@ { global.lifeData.dive_time_seconds = 0; // this apnea dive ends here } - if((global.lifeData.counterSecondsShallowDepth >= global.settings.timeoutDiveReachedZeroDepth) || (global.dataSendToSlave.setEndDive)) + if((global.lifeData.counterSecondsShallowDepth >= global.settings.timeoutDiveReachedZeroDepth) || (ManualExitDiveCounter)) { global.dataSendToMaster.mode = MODE_ENDDIVE; global.deviceDataSendToMaster.mode = MODE_ENDDIVE; @@ -814,6 +830,11 @@ clearDecoNow = 0; } + if(ManualExitDiveCounter) + { + ManualExitDiveCounter--; + } + if(global.seconds_since_last_dive) { schedule_update_timer_helper(-1); @@ -1381,6 +1402,7 @@ global.dataSendToMaster.data[boolPressureData].ascent_rate_meter_per_min = global.lifeData.ascent_rate_meter_per_min; global.dataSendToMaster.data[boolPressureData].pressure_uTick = HAL_GetTick(); global.dataSendToMaster.boolPressureData = boolPressureData; + global.dataSendToMaster.data[boolPressureData].SPARE1 = is_surface_pressure_stable(); } @@ -1587,16 +1609,25 @@ /* same as in data_central.c */ _Bool is_ambient_pressure_close_to_surface(SLifeData *lifeData) { - if(lifeData->pressure_ambient_bar == INVALID_PREASURE_VALUE) /* as long as no valid data is available expect we are close to surface */ + _Bool retval = true; + + if(lifeData->pressure_ambient_bar != INVALID_PREASURE_VALUE) /* as long as no valid data is available expect we are close to surface */ { - return true; + /* this will e.g. apply in case of a significant pressure change during last 30 minutes => use increased offset for surface detection */ + if (lifeData->pressure_ambient_bar > START_DIVE_IMMEDIATLY_BAR) + { + retval = false; + } + else if(is_surface_pressure_stable()) /* this is the expected start condition */ + { + if((lifeData->pressure_ambient_bar >= (lifeData->pressure_surface_bar + 0.1f)) + && (ManualExitDiveCounter == 0)) /* only if diver did not request to exit dive mode */ + { + retval = false; + } + } } - if (lifeData->pressure_ambient_bar > START_DIVE_IMMEDIATLY_BAR) - return false; - else if(lifeData->pressure_ambient_bar < (lifeData->pressure_surface_bar + 0.1f)) // hw 161121 now 1 mter, before 0.04f - return true; - else - return false; + return retval; }