Mercurial > public > ostc4
changeset 195:05df3b395615
Merged in janlmulder/ostc4/div-fixes-cleanup-1 (pull request #7)
Bugfix: show proper dive mode (and misc. cleanup)
author | heinrichsweikamp <bitbucket@heinrichsweikamp.com> |
---|---|
date | Tue, 19 Mar 2019 15:43:38 +0000 |
parents | cca59de24fe0 (current diff) f23b9055436f (diff) |
children | 2885628ab3ba 7116c0ffb862 |
files | Discovery/Inc/t9.h |
diffstat | 6 files changed, 43 insertions(+), 128 deletions(-) [+] |
line wrap: on
line diff
--- a/Discovery/Inc/logbook.h Fri Mar 15 15:48:53 2019 +0000 +++ b/Discovery/Inc/logbook.h Tue Mar 19 15:43:38 2019 +0000 @@ -200,7 +200,6 @@ } SManualGas; void logbook_writeSample(SDiveState state); -//void logbook_writeSampleFinalBytes(void); void logbook_initNewdiveProfile(const SDiveState* pInfo, SSettings* pSettings); void logbook_EndDive(void);
--- a/Discovery/Inc/t9.h Fri Mar 15 15:48:53 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/// -*- coding: UTF-8 -*- -/// -/// \file Discovery/Inc/t9.h -/// \brief Header file of Divemode with 9 windows, based on t7 -/// \author heinrichs weikamp gmbh -/// \date 7-July-2016 -/// -/// $Id$ -/////////////////////////////////////////////////////////////////////////////// -/// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh -/// -/// This program is free software: you can redistribute it and/or modify -/// it under the terms of the GNU General Public License as published by -/// the Free Software Foundation, either version 3 of the License, or -/// (at your option) any later version. -/// -/// This program is distributed in the hope that it will be useful, -/// but WITHOUT ANY WARRANTY; without even the implied warranty of -/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -/// GNU General Public License for more details. -/// -/// You should have received a copy of the GNU General Public License -/// along with this program. If not, see <http://www.gnu.org/licenses/>. -////////////////////////////////////////////////////////////////////////////// - -/* Define to prevent recursive inclusion -------------------------------------*/ -#ifndef T9_H -#define T9_H - -/* Includes ------------------------------------------------------------------*/ -#include "stm32f4xx_hal.h" -#include "gfx_engine.h" - -/* Exported functions --------------------------------------------------------*/ -void t9_init(void); - -void t9_refresh(void); -void t9_refresh_sleepmode_fun(void); -void t9_refresh_customview_old(void); - -void t9_change_field(void); -void t9_change_customview(void); - -void t9_set_field_to_primary(void); -void t9_set_customview_to_primary(void); - -void init_t9_compass(void); - -/* - void t9c_refresh(uint32_t FramebufferStartAddress); -*/ - -#endif /* T9_H */
--- a/Discovery/Src/logbook.c Fri Mar 15 15:48:53 2019 +0000 +++ b/Discovery/Src/logbook.c Tue Mar 19 15:43:38 2019 +0000 @@ -78,27 +78,25 @@ /* Exported variables --------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ -uint8_t data_store[10000]; -SLogbookHeader header; -SLogbookHeaderOSTC3 headerOSTC3; -SLogbookHeaderOSTC3compact headerOSTC3compact; -SSmallHeader smallHeader; -SDivisor divisor; -SDivisor divisorBackup; +static SLogbookHeader header; +static SLogbookHeaderOSTC3 headerOSTC3; +static SLogbookHeaderOSTC3compact headerOSTC3compact; +static SSmallHeader smallHeader; +static SDivisor divisor; +static SDivisor divisorBackup; /* Private function prototypes -----------------------------------------------*/ -void clear_divisor(void); -void logbook_SetAverageDepth(float average_depth_meter); -void logbook_SetMinTemperature(float min_temperature_celsius); -void logbook_SetMaxCNS(float max_cns_percentage); -void logbook_SetCompartmentDesaturation(void); -void logbook_SetLastStop(float last_stop_depth_bar); -void logbook_writedata(void * data, int length_byte); -void logbook_UpdateHeader(void); +static void clear_divisor(void); +static void logbook_SetAverageDepth(float average_depth_meter); +static void logbook_SetMinTemperature(float min_temperature_celsius); +static void logbook_SetMaxCNS(float max_cns_percentage); +static void logbook_SetCompartmentDesaturation(void); +static void logbook_SetLastStop(float last_stop_depth_bar); +static void logbook_writedata(void * data, int length_byte); +static void logbook_UpdateHeader(void); /* Exported functions --------------------------------------------------------*/ -/** used by test_vpm.c at the moment */ void logbook_EndDive(void) { ext_flash_close_new_dive_log((uint8_t*) &header); @@ -143,31 +141,6 @@ /** ****************************************************************************** - * @brief logbook_getHeaderOSTC3. / - * @author heinrichs weikamp gmbh - * @version V0.0.1 - * @date 26-Nov-2014 - ****************************************************************************** - * - * @param StepBackwards : 0 Last lokbook entry, 1 second to last entry, etc. - * @param SSLogbookHeader* pLogbookHeader: Output found LogbookHeader - * @return uint8_t : 1 = success -*/ -/* -SLogbookHeaderOSTC3 * logbook_getHeaderOSTC3(uint8_t StepBackwards) -{ - if(!logbook_getHeader(StepBackwards, &header)) - return 0; - else - { - logbook_build_ostc3header(); - return &headerOSTC3; - } -} -*/ - -/** - ****************************************************************************** * @brief logbook_getNumberOfHeaders. / * @author heinrichs weikamp gmbh * @version V0.0.1 @@ -350,7 +323,7 @@ ****************************************************************************** * */ -void clear_divisor(void) +static void clear_divisor(void) { divisor.cns = smallHeader.cnsDivisor - 1; divisor.decoplan = smallHeader.decoplanDivisor - 1; @@ -373,12 +346,12 @@ * @param uint8_t *pos: Output 8 bit array * @param uint16_t var: 16 bit variable */ -void addU16(uint8_t *pos, uint16_t var) +static void addU16(uint8_t *pos, uint16_t var) { *((uint16_t*)pos) = var; } -void addS16(uint8_t *pos, int16_t var) +static void addS16(uint8_t *pos, int16_t var) { *((int16_t*)pos) = var; } @@ -655,14 +628,6 @@ } - - -uint16_t actual_depth1; -uint16_t actual_depth2; -uint16_t actual_length1; -uint16_t actual_length2; -uint16_t actual_inum; - /** ****************************************************************************** * @brief readSample. / Reads data of one logbook sample @@ -678,7 +643,7 @@ * @param int32_t* cns: output Value * @return bytes read / 0 = reading Error */ -uint16_t readSample(int32_t* depth, int16_t * gasid, int16_t* setpoint_cbar, int32_t* temperature, int32_t* sensor1, int32_t* sensor2, int32_t* sensor3, int32_t* cns, SManualGas* manualGas, int16_t* bailout, int16_t* decostopDepth) +static uint16_t readSample(int32_t* depth, int16_t * gasid, int16_t* setpoint_cbar, int32_t* temperature, int32_t* sensor1, int32_t* sensor2, int32_t* sensor3, int32_t* cns, SManualGas* manualGas, int16_t* bailout, int16_t* decostopDepth) { int length = 0; _Bool bEvent = 0; @@ -1254,7 +1219,7 @@ * @version V0.0.1 * @date 27-Nov-2014 *********************************************************************************/ -void logbook_UpdateHeader(void) +static void logbook_UpdateHeader(void) { const SDiveState * pStateReal = stateRealGetPointer(); @@ -1354,19 +1319,19 @@ } -void logbook_SetAverageDepth(float average_depth_meter) +static void logbook_SetAverageDepth(float average_depth_meter) { header.averageDepth_mbar = (uint16_t)(average_depth_meter * 100); } -void logbook_SetMinTemperature(float min_temperature_celsius) +static void logbook_SetMinTemperature(float min_temperature_celsius) { header.minTemp = (int16_t)((min_temperature_celsius * 10.0f) + 0.5f); } -void logbook_SetMaxCNS(float max_cns_percentage) +static void logbook_SetMaxCNS(float max_cns_percentage) { if(max_cns_percentage < 9999) header.maxCNS = (uint16_t)(max_cns_percentage); @@ -1375,13 +1340,7 @@ } -void logbook_SetDesaturationTime(void) -{ - header.desaturationTime = 48 * 60; -} - - -void logbook_SetCompartmentDesaturation(void) +static void logbook_SetCompartmentDesaturation(void) { const SDiveState * pStateReal = stateRealGetPointer(); @@ -1399,12 +1358,12 @@ } } -void logbook_SetLastStop(float last_stop_depth_bar) +static void logbook_SetLastStop(float last_stop_depth_bar) { header.lastDecostop_m = (uint8_t)(last_stop_depth_bar / 10.0f); } -void logbook_writedata(void * data, int length_byte) +static void logbook_writedata(void * data, int length_byte) { ext_flash_write_sample(data, length_byte); }
--- a/Discovery/Src/t7.c Fri Mar 15 15:48:53 2019 +0000 +++ b/Discovery/Src/t7.c Tue Mar 19 15:43:38 2019 +0000 @@ -68,7 +68,7 @@ uint8_t t7_customtextPrepare(char * text); -/* Importend function prototypes ---------------------------------------------*/ +/* Imported function prototypes ---------------------------------------------*/ extern uint8_t write_gas(char *text, uint8_t oxygen, uint8_t helium); /* Exported variables --------------------------------------------------------*/ @@ -1016,11 +1016,22 @@ } /* dive mode */ - if(stateUsed->diveSettings.diveMode == DIVEMODE_CCR) - GFX_write_string(&FontT24,&t7c1,"\f\002" "CCR",0); - else - GFX_write_string(&FontT24,&t7c1,"\f\002" "OC",0); -// GFX_write_string(&FontT24,&t7c1,"\f\177\177\x80" "CCR",0); + switch (stateUsed->diveSettings.diveMode) { + case DIVEMODE_CCR: + GFX_write_string(&FontT24, &t7c1, "\f\002" "CCR", 0); + break; + case DIVEMODE_OC: + GFX_write_string(&FontT24, &t7c1, "\f\002" "OC", 0); + break; + case DIVEMODE_Gauge: + GFX_write_string(&FontT24, &t7c1, "\f\002" "Gauge", 0); + break; + case DIVEMODE_Apnea: + GFX_write_string(&FontT24, &t7c1, "\f\002" "Apnea", 0); + break; + default: + GFX_write_string(&FontT24, &t7c1, "\f\002" "OC", 0); + } /*battery */
--- a/Discovery/Src/tHome.c Fri Mar 15 15:48:53 2019 +0000 +++ b/Discovery/Src/tHome.c Tue Mar 19 15:43:38 2019 +0000 @@ -36,7 +36,6 @@ #include "t5_gauge.h" #include "t6_apnea.h" #include "t7.h" -#include "t9.h" #include "tDebug.h" #include "timer.h" // for timer_Stopwatch_Restart #include "tMenu.h"