Mercurial > public > ostc4
changeset 951:e9c37071933b Evo_2_23
Added vibration warning:
The internal buzzer of the GPIO_V2 may now be used as additional warning notificator. It can be activated using the check button in the customer view menu. The vibration will be active while the warning message is displayed in the dive window. In case the diver is in the menu then the warning will be active for a shorter duration.
author | Ideenmodellierer |
---|---|
date | Sun, 29 Dec 2024 18:29:56 +0100 |
parents | 922ee3d7d2f3 |
children | 33e24b77cc6c |
files | Common/Inc/data_central.h Common/Inc/data_exchange.h Common/Inc/settings.h Discovery/Inc/check_warning.h Discovery/Inc/tStructure.h Discovery/Inc/text_multilanguage.h Discovery/Src/data_exchange_main.c Discovery/Src/settings.c Discovery/Src/t3.c Discovery/Src/t7.c Discovery/Src/tMenu.c Discovery/Src/tMenuCustom.c Discovery/Src/tMenuEdit.c Discovery/Src/tMenuEditCustom.c Discovery/Src/text_multilanguage.c Small_CPU/Inc/gpio.h Small_CPU/Src/gpio.c Small_CPU/Src/scheduler.c |
diffstat | 18 files changed, 148 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Common/Inc/data_central.h Thu Dec 26 12:03:08 2024 +0100 +++ b/Common/Inc/data_central.h Sun Dec 29 18:29:56 2024 +0100 @@ -44,6 +44,10 @@ #define EXT_INTERFACE_SENSOR_CNT (8u) /* 1 MUX + 7 sensors may be connected to the external interface (1 MUX + 3 ADC + 4 UART) */ #define EXT_INTERFACE_MUX_OFFSET (3u) /* the sensor struct starts with 3 ADC sensors */ +#define EXT_INTERFACE_BUZZER_ON_TIME_MS (2000u) /* max time the buzzer should be active without break */ +#define EXT_INTERFACE_BUZZER_STABLE_TIME_MS (500u) /* min time a state (ON / OFF) should be stable before it may be changed */ + + /* Helper structs ------------------------------------------------------------*/ //struct SGas
--- a/Common/Inc/data_exchange.h Thu Dec 26 12:03:08 2024 +0100 +++ b/Common/Inc/data_exchange.h Sun Dec 29 18:29:56 2024 +0100 @@ -38,6 +38,7 @@ /* 4th nibble command channel */ #define EXT_INTERFACE_33V_ON (0x8000u) /* Bit set to enable 3.3V power interface */ #define EXT_INTERFACE_ADC_ON (0x4000u) /* Bit set to enable ADC conversion */ +#define EXT_INTERFACE_BUZZER_ON (0x2000u) /* Bit set to enable the buzzer */ /* Command subset */ #define EXT_INTERFACE_AUTODETECT (0x0001u) /* Start auto detection of connected sensors */
--- a/Common/Inc/settings.h Thu Dec 26 12:03:08 2024 +0100 +++ b/Common/Inc/settings.h Sun Dec 29 18:29:56 2024 +0100 @@ -324,6 +324,7 @@ uint8_t slowExitTime; /* new in 0xFFFF002c */ StimeZone timeZone; + uint8_t warningBuzzer; } SSettings; typedef struct
--- a/Discovery/Inc/check_warning.h Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Inc/check_warning.h Sun Dec 29 18:29:56 2024 +0100 @@ -45,4 +45,6 @@ uint8_t getSetpointHighId(void); uint8_t getSetpointLowId(void); uint8_t getSetpointDecoId(void); +void requestBuzzerActivation(uint8_t active); +uint8_t getBuzzerActivationState(); #endif // CHECK_WARNING_H
--- a/Discovery/Inc/tStructure.h Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Inc/tStructure.h Sun Dec 29 18:29:56 2024 +0100 @@ -382,12 +382,16 @@ #define StMCustom4_CViewSelection1 _MB(2,9,4,1,0) +#ifdef ENABLE_MOTION_CONTROL #define StMCustom5_CViewPortCalib _MB(2,9,5,1,0) #define StMCustom5_CViewPortSpotSize _MB(2,9,5,2,0) #define StMCustom5_CViewPortLayout _MB(2,9,5,3,0) #define StMCustom5_CViewPortAmbient _MB(2,9,5,4,0) #define StMCustom5_CViewPortControl _MB(2,9,5,5,0) - +#endif +#ifdef ENABLE_GPIO_V2 +#define StMCustom5_CViewWarningBuz _MB(2,9,5,1,0) +#endif /* PAGE 10 */ #define StMPLAN _MB(2,10,0,0,0)
--- a/Discovery/Inc/text_multilanguage.h Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Inc/text_multilanguage.h Sun Dec 29 18:29:56 2024 +0100 @@ -393,6 +393,8 @@ TXT2BYTE_YYMMDD, TXT2BYTE_TIMEZONE, + TXT2BYTE_BUZZER, + TXT2BYTE_END, };
--- a/Discovery/Src/data_exchange_main.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/data_exchange_main.c Sun Dec 29 18:29:56 2024 +0100 @@ -73,6 +73,7 @@ #include "buehlmann.h" #include "externLogbookFlash.h" #include "vpm.h" +#include "check_warning.h" /* #define TESTBENCH */ @@ -441,6 +442,13 @@ } #endif +#ifdef ENABLE_GPIO_V2 + if(getBuzzerActivationState()) + { + externalInterface_Cmd |= EXT_INTERFACE_BUZZER_ON; + } +#endif + dataOut.data.externalInterface_Cmd = externalInterface_Cmd; externalInterface_Cmd = 0; @@ -583,13 +591,16 @@ RTC_DateTypeDef sdatestructure; RTC_TimeTypeDef stimestructure; + const SFirmwareData *pFirmwareInfo; + pFirmwareInfo = firmwareDataGetPointer(); + stimestructure.Hours = UNKNOWN_TIME_HOURS; stimestructure.Minutes = UNKNOWN_TIME_MINUTES; stimestructure.Seconds = UNKNOWN_TIME_SECOND; sdatestructure.Date = UNKNOWN_DATE_DAY; sdatestructure.Month = UNKNOWN_DATE_MONTH; - sdatestructure.Year = UNKNOWN_DATE_YEAR; + sdatestructure.Year = pFirmwareInfo->release_year; setWeekday(&sdatestructure); DataEX_helper_SetTime(stimestructure, &lineWrite->time_rtc_tr);
--- a/Discovery/Src/settings.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/settings.c Sun Dec 29 18:29:56 2024 +0100 @@ -342,7 +342,8 @@ .cvAutofocus = 0, .slowExitTime = 0, .timeZone.hours = 0, - .timeZone.minutes = 0 + .timeZone.minutes = 0, + .warningBuzzer = 0 }; /* Private function prototypes -----------------------------------------------*/ @@ -608,6 +609,7 @@ case 0xFFFF002B: Settings.timeZone.hours = 0; Settings.timeZone.minutes = 0; + Settings.warningBuzzer = 0; // no break; default: pSettings->header = pStandard->header; @@ -1317,6 +1319,16 @@ setFirstCorrection(parameterId); } parameterId++; + + if(Settings.warningBuzzer > 1) + { + Settings.warningBuzzer = 0; + corrections++; + setFirstCorrection(parameterId); + } + parameterId++; + + /* uint8_t serialHigh; */
--- a/Discovery/Src/t3.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/t3.c Sun Dec 29 18:29:56 2024 +0100 @@ -762,10 +762,14 @@ customview_warnings = t3_test_customview_warnings(); if(customview_warnings && warning_count_high_time) + { t3_basics_show_customview_warnings(&t3c1); + } else + { t3_refresh_customview(depth_meter); - + requestBuzzerActivation(0); + } if(stateUsed->warnings.lowBattery) t3_basics_battery_low_customview_extra(&t3r1); //t3c1); } @@ -1534,7 +1538,9 @@ { char text[256], textMain[256]; uint8_t textpointer, textpointerMain, lineFree, more; +#ifdef HAVE_DEBUG_WARNINGS uint8_t index = 0; +#endif snprintf(text,TEXTSIZE,"\025\f%c",TXT_Warning); GFX_write_string(&FontT42,&t3c1,text,0); @@ -1680,6 +1686,7 @@ { GFX_write_string(&FontT48,&t3c2,text,0); } + requestBuzzerActivation(1); } uint8_t t3_customview_disabled(uint8_t view)
--- a/Discovery/Src/t7.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/t7.c Sun Dec 29 18:29:56 2024 +0100 @@ -1502,7 +1502,9 @@ { char text[256]; uint8_t textpointer, lineFree; +#ifdef HAVE_DEBUG_WARNINGS uint8_t index = 0; +#endif text[0] = '\025'; text[1] = '\f'; @@ -1614,6 +1616,7 @@ } */ GFX_write_string(&FontT48,&t7cW,text,1); + requestBuzzerActivation(1); } @@ -3217,7 +3220,10 @@ if(customview_warnings && warning_count_high_time) t7_show_customview_warnings(); else + { t7_refresh_customview(); + requestBuzzerActivation(0); + } /* the frame */ draw_frame(1,1, CLUT_DIVE_pluginbox, CLUT_DIVE_FieldSeperatorLines);
--- a/Discovery/Src/tMenu.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/tMenu.c Sun Dec 29 18:29:56 2024 +0100 @@ -864,6 +864,8 @@ if((page == 0) || (line == 0)) return; + requestBuzzerActivation(0); + menu.pageMemoryForNavigation = page; /* new test for 3button design */ if(freshWithFlipPages)
--- a/Discovery/Src/tMenuCustom.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/tMenuCustom.c Sun Dec 29 18:29:56 2024 +0100 @@ -118,6 +118,26 @@ strcpy(&text[textPointer],"\n\r"); textPointer += 2; #endif + +#ifdef ENABLE_GPIO_V2 + if((line == 0) || (line == 5)) + { + /* MotionCtrl */ + text[textPointer++] = TXT_2BYTE; + text[textPointer++] = TXT2BYTE_BUZZER; + text[textPointer++] = ' '; + text[textPointer++] = TXT_Warning; + text[textPointer++] = '\t'; + if(settingsGetPointer()->warningBuzzer) + text[textPointer++] = '\005'; + else + text[textPointer++] = '\006'; + } + + strcpy(&text[textPointer],"\n\r"); + textPointer += 2; +#endif + return StMCustom; }
--- a/Discovery/Src/tMenuEdit.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/tMenuEdit.c Sun Dec 29 18:29:56 2024 +0100 @@ -256,10 +256,12 @@ case StMCustom3_CViewSelection5: case StMCustom3_CViewSelection6: refreshFct = CustomviewDivemode_refresh; break; +#ifdef ENABLE_MOTION_CONTROL case (StMCustom5_CViewPortCalib & MaskFieldDigit): case StMCustom5_CViewPortLayout: case StMCustom5_CViewPortAmbient: refreshFct = refresh_ViewPort; break; +#endif default: /* no menu has been updated */ break; }
--- a/Discovery/Src/tMenuEditCustom.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/tMenuEditCustom.c Sun Dec 29 18:29:56 2024 +0100 @@ -56,6 +56,7 @@ void openEdit_BigScreen(void); void openEdit_MotionCtrl(void); void openEdit_ViewPort(void); +void openEdit_WarningBuz(void); void refresh_Customviews(void); void setMenuContentStructure(); char customview_TXT2BYTE_helper(uint8_t customViewId); @@ -126,7 +127,6 @@ tMenuEdit_refresh_field(StMCustom1_CViewAutoFocusBF); - // field corner return textpointer = 0; text[textpointer++] = TXT_2BYTE; @@ -375,8 +375,14 @@ break; case 4: openEdit_CustomviewDivemode(cv_changelist_BS); break; +#ifdef ENABLE_MOTION_CONTROL case 5: openEdit_ViewPort(); break; +#endif +#ifdef ENABLE_GPIO_V2 + case 5: openEdit_WarningBuz(); + break; +#endif } } @@ -450,6 +456,7 @@ void openEdit_ViewPort(void) { +#ifdef ENABLE_MOTION_CONTROL resetMenuEdit(CLUT_MenuPageCustomView); refresh_ViewPort(); @@ -464,8 +471,22 @@ setEvent(StMCustom5_CViewPortLayout, (uint32_t)OnAction_CViewPortLayout); setEvent(StMCustom5_CViewPortAmbient, (uint32_t)OnAction_CViewPortAmbient); setEvent(StMCustom5_CViewPortControl, (uint32_t)OnAction_CViewPortControl); +#endif } +void openEdit_WarningBuz(void) +{ + SSettings *pSettings = settingsGetPointer(); + if(pSettings->warningBuzzer == 0) + { + pSettings->warningBuzzer = 1; + } + else + { + pSettings->warningBuzzer = 0; + } + exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); +} char customview_TXT2BYTE_helper(uint8_t customViewId) {
--- a/Discovery/Src/text_multilanguage.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Discovery/Src/text_multilanguage.c Sun Dec 29 18:29:56 2024 +0100 @@ -1993,6 +1993,12 @@ static uint8_t text_IT_TIMEZONE[] = ""; static uint8_t text_ES_TIMEZONE[] = ""; +static uint8_t text_EN_BUZZER[] = "Buzzer"; +static uint8_t text_DE_BUZZER[] = "Vibration"; +static uint8_t text_FR_BUZZER[] = ""; +static uint8_t text_IT_BUZZER[] = ""; +static uint8_t text_ES_BUZZER[] = ""; + /* Lookup Table -------------------------------------------------------------*/ const tText text_array[] = @@ -2301,6 +2307,7 @@ {(uint8_t)TXT2BYTE_YYMMDD, {text_EN_YYMMDD, text_DE_YYMMDD, text_FR_YYMMDD, text_IT_YYMMDD, text_ES_YYMMDD}}, {(uint8_t)TXT2BYTE_TIMEZONE, {text_EN_TIMEZONE, text_DE_TIMEZONE, text_FR_TIMEZONE, text_IT_TIMEZONE, text_ES_TIMEZONE}}, + {(uint8_t)TXT2BYTE_BUZZER, {text_EN_BUZZER, text_DE_BUZZER, text_FR_BUZZER, text_IT_BUZZER, text_ES_BUZZER}}, };
--- a/Small_CPU/Inc/gpio.h Thu Dec 26 12:03:08 2024 +0100 +++ b/Small_CPU/Inc/gpio.h Sun Dec 29 18:29:56 2024 +0100 @@ -49,6 +49,8 @@ void GPIO_GPS_ON(void); void GPIO_GPS_BCKP_OFF(void); void GPIO_GPS_BCKP_ON(void); + +void GPIO_HandleBuzzer(); #endif #ifdef __cplusplus }
--- a/Small_CPU/Src/gpio.c Thu Dec 26 12:03:08 2024 +0100 +++ b/Small_CPU/Src/gpio.c Sun Dec 29 18:29:56 2024 +0100 @@ -23,6 +23,8 @@ #include "stm32f4xx_hal.h" #include "gpio.h" +#include "data_exchange.h" +#include "scheduler.h" /* Exported variables --------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ @@ -89,6 +91,40 @@ HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); } +#ifdef ENABLE_GPIO_V2 +void GPIO_HandleBuzzer() +{ + static uint32_t buzzerOnTick = 0; + static uint8_t buzzerWasOn = 0; + + if(((global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_BUZZER_ON) != 0)) + { + if(!buzzerWasOn) + { + buzzerOnTick = HAL_GetTick(); + GPIO_VIBRATION_ON(); + /* GPIO_LED_RED_ON(); */ + + if(time_elapsed_ms(buzzerOnTick,HAL_GetTick()) > EXT_INTERFACE_BUZZER_ON_TIME_MS) + { + GPIO_VIBRATION_OFF(); + /* GPIO_LED_RED_OFF(); */ + } + } + buzzerWasOn = 1; + } + else + { + if(buzzerWasOn) + { + buzzerOnTick = 0; + GPIO_VIBRATION_OFF(); + /* GPIO_LED_RED_OFF(); */ + } + buzzerWasOn = 0; + } +} +#endif void GPIO_Power_MainCPU_ON(void) { HAL_GPIO_WritePin( GPIOC, MAINCPU_CONTROL_PIN, GPIO_PIN_RESET); }