# HG changeset patch
# User Ideenmodellierer
# Date 1668973570 -3600
# Node ID 88f73b05d45cf3a1d1e02b9af0927876f5c358c3
# Parent 74cfd91199bd19a68757e4ed645b4902ba3a3e0b
Added new info page for extended sensor data:
The new source file may be used to create a information page individual for every smart sensor type. The DiveO2 sensor is the first supported sensor
diff -r 74cfd91199bd -r 88f73b05d45c Discovery/Inc/tInfoSensor.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Discovery/Inc/tInfoSensor.h Sun Nov 20 20:46:10 2022 +0100
@@ -0,0 +1,37 @@
+///////////////////////////////////////////////////////////////////////////////
+/// -*- coding: UTF-8 -*-
+///
+/// \file Discovery/Inc/tInfoSensor.h
+/// \brief Infopage content for connected smart sensors
+/// \author heinrichs weikamp gmbh
+/// \date 17-11-2022
+///
+/// $Id$
+///////////////////////////////////////////////////////////////////////////////
+/// \par Copyright (c) 2014-2022 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 .
+//////////////////////////////////////////////////////////////////////////////
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef TINFO_SENSOR_H
+#define TINFO_SENSOR_H
+
+/* Exported functions --------------------------------------------------------*/
+void openInfo_Sensor(void);
+void refreshInfo_Sensor(GFX_DrawCfgScreen s);
+void sendActionToInfoSensor(uint8_t sendAction);
+
+
+#endif /* TINFO_COMPASS_H */
diff -r 74cfd91199bd -r 88f73b05d45c Discovery/Src/tInfoSensor.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Discovery/Src/tInfoSensor.c Sun Nov 20 20:46:10 2022 +0100
@@ -0,0 +1,127 @@
+///////////////////////////////////////////////////////////////////////////////
+/// -*- coding: UTF-8 -*-
+///
+/// \file Discovery/Src/tInfoCompass.c
+/// \brief there is only compass_DX_f, compass_DY_f, compass_DZ_f output during this mode
+/// \author heinrichs weikamp gmbh
+/// \date 23-Feb-2015
+///
+/// \details
+///
+/// $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 .
+//////////////////////////////////////////////////////////////////////////////
+
+/* Includes ------------------------------------------------------------------*/
+
+#include "gfx_engine.h"
+#include "gfx_fonts.h"
+#include "tHome.h"
+#include "tInfo.h"
+#include "tInfoSensor.h"
+#include "tMenuEdit.h"
+
+#include
+#include
+
+extern void openEdit_O2Sensors(void);
+
+/* Private variables ---------------------------------------------------------*/
+
+/* Exported functions --------------------------------------------------------*/
+void openInfo_Sensor(void)
+{
+ set_globalState(StISENINFO);
+ setBackMenu((uint32_t)openEdit_O2Sensors,0,6);
+}
+
+
+
+uint64_t mod64(uint64_t a, uint64_t b)
+{
+ uint64_t div;
+ div=(a/10);
+ b=(10*div);
+ return (a-b);
+}
+
+void uint64ToString(uint64_t value, char* pbuf)
+{
+ char tmpBuf[32];
+ uint8_t index = 31;
+
+ tmpBuf[index--] = 0; /* zero termination */
+ while((index != 0) && (value != 0))
+ {
+ tmpBuf[index--] = '0' + (value % 10);// mod64(worker64,10);
+ value /= 10;
+ }
+ strcpy(pbuf,&tmpBuf[index+1]);
+}
+
+// ===============================================================================
+// refreshInfo_Compass
+/// @brief there is only compass_DX_f, compass_DY_f, compass_DZ_f output during this mode
+/// the accel is not called during this process
+// ===============================================================================
+void refreshInfo_Sensor(GFX_DrawCfgScreen s)
+{
+ SSensorDataDiveO2* pDiveO2Data;
+ char text[31];
+ uint8_t strIndex = 0;
+
+ text[0] = '\001';
+ text[1] = TXT_Sensor;
+ text[2] = ' ';
+ text[3] = TXT_Information;
+ text[4] = 0;
+ tInfo_write_content_simple( 30, 340, ME_Y_LINE_BASE, &FontT48, text, CLUT_MenuPageHardware);
+
+
+ pDiveO2Data = (SSensorDataDiveO2*)stateRealGetPointer()->lifeData.extIf_sensor_data;
+
+ strIndex = snprintf(text,32,"ID: ");
+ if(pDiveO2Data->sensorId != 0)
+ {
+ uint64ToString(pDiveO2Data->sensorId,&text[strIndex]);
+ }
+ tInfo_write_content_simple( 30, 340, ME_Y_LINE1, &FontT48, text, CLUT_Font020);
+ snprintf(text,32,"%c: %02.1f",TXT_Temperature , (float)pDiveO2Data->temperature / 1000.0);
+ tInfo_write_content_simple( 30, 340, ME_Y_LINE2, &FontT48, text, CLUT_Font020);
+}
+
+void sendActionToInfoSensor(uint8_t sendAction)
+{
+
+ switch(sendAction)
+ {
+
+ case ACTION_BUTTON_BACK:
+ exitMenuEdit_to_BackMenu();
+ break;
+
+ case ACTION_BUTTON_ENTER:
+ case ACTION_BUTTON_NEXT:
+ case ACTION_TIMEOUT:
+ case ACTION_MODE_CHANGE:
+ case ACTION_IDLE_TICK:
+ case ACTION_IDLE_SECOND:
+ default:
+ break;
+ }
+}
+