From cb9676d4d1ec82a0bc8c8ce416118ce75bd0bc44 Mon Sep 17 00:00:00 2001 From: VerstreuteSeele Date: Tue, 3 Jan 2023 22:02:23 +0100 Subject: [PATCH] One of too many. Cloning the Apps from gh for easy-updates --- applications/plugins/unitemp/README.md | 3 +- applications/plugins/unitemp/Sensors.c | 17 +- applications/plugins/unitemp/Sensors.h | 2 - applications/plugins/unitemp/application.fam | 3 +- .../unitemp/interfaces/SingleWireSensor.c | 4 +- applications/plugins/unitemp/sensors/DHT20.c | 154 ------------------ applications/plugins/unitemp/sensors/DHT20.h | 63 ------- applications/plugins/unitemp/sensors/SHT30.c | 90 ---------- applications/plugins/unitemp/sensors/SHT30.h | 70 -------- .../plugins/unitemp/sensors/Sensors.xlsx | Bin 12265 -> 11864 bytes .../plugins/unitemp/views/General_view.c | 3 +- .../plugins/unitemp/views/SensorEdit_view.c | 14 +- .../plugins/unitemp/views/Widgets_view.c | 2 +- 13 files changed, 14 insertions(+), 411 deletions(-) delete mode 100644 applications/plugins/unitemp/sensors/DHT20.c delete mode 100644 applications/plugins/unitemp/sensors/DHT20.h delete mode 100644 applications/plugins/unitemp/sensors/SHT30.c delete mode 100644 applications/plugins/unitemp/sensors/SHT30.h diff --git a/applications/plugins/unitemp/README.md b/applications/plugins/unitemp/README.md index 257e8a8ae..2f753faea 100644 --- a/applications/plugins/unitemp/README.md +++ b/applications/plugins/unitemp/README.md @@ -1,9 +1,10 @@ ![Flipper usage](https://user-images.githubusercontent.com/10090793/206618263-c1e212e4-58dc-432e-87a8-5c19fd835b35.png) # Unitemp - Universal temperature sensor reader [![GitHub release](https://img.shields.io/github/release/quen0n/unitemp-flipperzero?include_prereleases=&sort=semver&color=blue)](https://github.com/quen0n/unitemp-flipperzero/releases/) +[![GitHub all releases](https://img.shields.io/github/downloads/quen0n/unitemp-flipperzero/total)]() [![GitHub](https://img.shields.io/github/license/quen0n/unitemp-flipperzero)](https://github.com/quen0n/unitemp-flipperzero/blob/dev/LICENSE.md) [Flipper Zero](https://flipperzero.one/) application for reading temperature, humidity and pressure sensors using Onewire, Singlewire, I2C protocols. ## List of supported sensors (supplemented) -![image](https://user-images.githubusercontent.com/10090793/209491886-f4c5ef6e-38b2-45b8-a8e7-4aeca9e155f2.png) +![image](https://user-images.githubusercontent.com/10090793/208480561-e98a6192-d44d-4ad9-8692-a91ccaae47c7.png) ## Installation Copy the contents of the repository to the `applications/plugins/unitemp` folder and build the project. Flash FZ along with resources. [More...](https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/fbt.md) diff --git a/applications/plugins/unitemp/Sensors.c b/applications/plugins/unitemp/Sensors.c index f202794f4..d35e31931 100644 --- a/applications/plugins/unitemp/Sensors.c +++ b/applications/plugins/unitemp/Sensors.c @@ -71,21 +71,8 @@ const Interface ONE_WIRE = { //Перечень интерфейсов подключения //static const Interface* interfaces[] = {&SINGLE_WIRE, &I2C, &ONE_WIRE}; //Перечень датчиков -static const SensorType* sensorTypes[] = { - &DHT11, - &DHT12_SW, - &DHT20, - &DHT21, - &DHT22, - &Dallas, - &AM2320_SW, - &AM2320_I2C, - &AHT10, - &SHT30, - &GXHT30, - &LM75, - &BMP280, - &BME280}; +static const SensorType* sensorTypes[] = + {&DHT11, &DHT12_SW, &DHT21, &DHT22, &AM2320_SW, &AM2320_I2C, &LM75, &BMP280, &BME280, &Dallas}; const SensorType* unitemp_sensors_getTypeFromInt(uint8_t index) { if(index > SENSOR_TYPES_COUNT) return NULL; diff --git a/applications/plugins/unitemp/Sensors.h b/applications/plugins/unitemp/Sensors.h index 0643ffb1f..52e6165f5 100644 --- a/applications/plugins/unitemp/Sensors.h +++ b/applications/plugins/unitemp/Sensors.h @@ -321,6 +321,4 @@ const GPIO* //BMP280, BME280 #include "./sensors/BMx280.h" #include "./sensors/AM2320.h" -#include "./sensors/DHT20.h" -#include "./sensors/SHT30.h" #endif diff --git a/applications/plugins/unitemp/application.fam b/applications/plugins/unitemp/application.fam index 23ad07223..4fc9472cc 100644 --- a/applications/plugins/unitemp/application.fam +++ b/applications/plugins/unitemp/application.fam @@ -1,5 +1,5 @@ App( - appid="Temp_Sensors_Reader", + appid="unitemp", name="Unitemp", apptype=FlipperAppType.EXTERNAL, entry_point="unitemp_app", @@ -16,5 +16,4 @@ App( fap_icon="icon.png", fap_icon_assets="assets", fap_libs=["assets"], - fap_icon_assets_symbol="unitemp", ) \ No newline at end of file diff --git a/applications/plugins/unitemp/interfaces/SingleWireSensor.c b/applications/plugins/unitemp/interfaces/SingleWireSensor.c index e601e086e..183bfc872 100644 --- a/applications/plugins/unitemp/interfaces/SingleWireSensor.c +++ b/applications/plugins/unitemp/interfaces/SingleWireSensor.c @@ -43,7 +43,7 @@ const SensorType DHT12_SW = { .updater = unitemp_singlewire_update}; const SensorType DHT21 = { .typename = "DHT21", - .altname = "DHT21/AM2301", + .altname = "DHT21 (AM2301)", .interface = &SINGLE_WIRE, .datatype = UT_DATA_TYPE_TEMP_HUM, .pollingInterval = 1000, @@ -54,7 +54,7 @@ const SensorType DHT21 = { .updater = unitemp_singlewire_update}; const SensorType DHT22 = { .typename = "DHT22", - .altname = "DHT22/AM2302", + .altname = "DHT22 (AM2302)", .interface = &SINGLE_WIRE, .datatype = UT_DATA_TYPE_TEMP_HUM, .pollingInterval = 2000, diff --git a/applications/plugins/unitemp/sensors/DHT20.c b/applications/plugins/unitemp/sensors/DHT20.c deleted file mode 100644 index f16e8dfc1..000000000 --- a/applications/plugins/unitemp/sensors/DHT20.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - Unitemp - Universal temperature reader - Copyright (C) 2022 Victor Nikitchuk (https://github.com/quen0n) - - 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 . -*/ -#include "DHT20.h" -#include "../interfaces/I2CSensor.h" - -const SensorType DHT20 = { - .typename = "DHT20", - .altname = "DHT20/AM2108/AHT20", - .interface = &I2C, - .datatype = UT_TEMPERATURE | UT_HUMIDITY, - .pollingInterval = 1000, - .allocator = unitemp_DHT20_I2C_alloc, - .mem_releaser = unitemp_DHT20_I2C_free, - .initializer = unitemp_DHT20_init, - .deinitializer = unitemp_DHT20_I2C_deinit, - .updater = unitemp_DHT20_I2C_update}; -const SensorType AHT10 = { - .typename = "AHT10", - .interface = &I2C, - .datatype = UT_TEMPERATURE | UT_HUMIDITY, - .pollingInterval = 1000, - .allocator = unitemp_DHT20_I2C_alloc, - .mem_releaser = unitemp_DHT20_I2C_free, - .initializer = unitemp_DHT20_init, - .deinitializer = unitemp_DHT20_I2C_deinit, - .updater = unitemp_DHT20_I2C_update}; - -static uint8_t DHT20_get_status(I2CSensor* i2c_sensor) { - uint8_t status[1] = {0}; - unitemp_i2c_readArray(i2c_sensor, 1, status); - return status[0]; -} - -static uint8_t DHT20_calc_CRC8(uint8_t* message, uint8_t Num) { - uint8_t i; - uint8_t byte; - uint8_t crc = 0xFF; - for(byte = 0; byte < Num; byte++) { - crc ^= (message[byte]); - for(i = 8; i > 0; --i) { - if(crc & 0x80) - crc = (crc << 1) ^ 0x31; - else - crc = (crc << 1); - } - } - return crc; -} - -static void DHT20_reset_reg(I2CSensor* i2c_sensor, uint8_t addr) { - uint8_t data[3] = {addr, 0x00, 0x00}; - - unitemp_i2c_writeArray(i2c_sensor, 3, data); - - furi_delay_ms(5); - - unitemp_i2c_readArray(i2c_sensor, 3, data); - - furi_delay_ms(10); - - data[0] = 0xB0 | addr; - unitemp_i2c_writeArray(i2c_sensor, 3, data); -} - -bool unitemp_DHT20_I2C_alloc(Sensor* sensor, char* args) { - UNUSED(args); - I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance; - - //Адреса на шине I2C (7 бит) - i2c_sensor->minI2CAdr = 0x38 << 1; - i2c_sensor->maxI2CAdr = (sensor->type == &DHT20) ? (0x38 << 1) : (0x39 << 1); - return true; -} - -bool unitemp_DHT20_I2C_free(Sensor* sensor) { - //Нечего высвобождать, так как ничего не было выделено - UNUSED(sensor); - return true; -} - -bool unitemp_DHT20_init(Sensor* sensor) { - I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance; - - uint8_t data[3] = {0xA8, 0x00, 0x00}; - if(!unitemp_i2c_writeArray(i2c_sensor, 3, data)) return false; - furi_delay_ms(10); - data[0] = (sensor->type == &DHT20) ? 0xBE : 0xE1; - data[1] = 0x08; - if(!unitemp_i2c_writeArray(i2c_sensor, 3, data)) return false; - furi_delay_ms(10); - - return true; -} - -bool unitemp_DHT20_I2C_deinit(Sensor* sensor) { - //Нечего деинициализировать - UNUSED(sensor); - return true; -} - -UnitempStatus unitemp_DHT20_I2C_update(Sensor* sensor) { - I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance; - - if(DHT20_get_status(i2c_sensor) != 0x18) { - DHT20_reset_reg(i2c_sensor, 0x1B); - DHT20_reset_reg(i2c_sensor, 0x1C); - DHT20_reset_reg(i2c_sensor, 0x1E); - } - furi_delay_ms(10); - - uint8_t data[7] = {0xAC, 0x33, 0x00}; - if(!unitemp_i2c_writeArray(i2c_sensor, 3, data)) return UT_SENSORSTATUS_TIMEOUT; - furi_delay_ms(80); - uint32_t t = furi_get_tick(); - while(DHT20_get_status(i2c_sensor) == 0x80) { - if(furi_get_tick() - t > 10) return UT_SENSORSTATUS_TIMEOUT; - } - - if(!unitemp_i2c_readArray(i2c_sensor, 7, data)) return UT_SENSORSTATUS_TIMEOUT; - - if(DHT20_calc_CRC8(data, 6) != data[6]) { - return UT_SENSORSTATUS_BADCRC; - } - uint32_t RetuData = 0; - RetuData = (RetuData | data[1]) << 8; - RetuData = (RetuData | data[2]) << 8; - RetuData = (RetuData | data[3]); - RetuData = RetuData >> 4; - sensor->hum = RetuData * 100 * 10 / 1024.0f / 1024.0f / 10.0f; - - RetuData = 0; - RetuData = (RetuData | data[3]) << 8; - RetuData = (RetuData | data[4]) << 8; - RetuData = (RetuData | data[5]); - RetuData = RetuData & 0xfffff; - sensor->temp = (RetuData * 200 * 10.0f / 1024.0f / 1024.0f - 500) / 10.0f; - - return UT_SENSORSTATUS_OK; -} diff --git a/applications/plugins/unitemp/sensors/DHT20.h b/applications/plugins/unitemp/sensors/DHT20.h deleted file mode 100644 index db49495dc..000000000 --- a/applications/plugins/unitemp/sensors/DHT20.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Unitemp - Universal temperature reader - Copyright (C) 2022 Victor Nikitchuk (https://github.com/quen0n) - - 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 . -*/ -#ifndef UNITEMP_DHT20 -#define UNITEMP_DHT20 - -#include "../unitemp.h" -#include "../Sensors.h" -extern const SensorType DHT20; -extern const SensorType AHT10; -/** - * @brief Выделение памяти и установка начальных значений датчика DHT20 - * - * @param sensor Указатель на создаваемый датчик - * @return Истина при успехе - */ -bool unitemp_DHT20_I2C_alloc(Sensor* sensor, char* args); - -/** - * @brief Инициализации датчика DHT20 - * - * @param sensor Указатель на датчик - * @return Истина если инициализация упспешная - */ -bool unitemp_DHT20_init(Sensor* sensor); - -/** - * @brief Деинициализация датчика - * - * @param sensor Указатель на датчик - */ -bool unitemp_DHT20_I2C_deinit(Sensor* sensor); - -/** - * @brief Обновление значений из датчика - * - * @param sensor Указатель на датчик - * @return Статус обновления - */ -UnitempStatus unitemp_DHT20_I2C_update(Sensor* sensor); - -/** - * @brief Высвободить память датчика - * - * @param sensor Указатель на датчик - */ -bool unitemp_DHT20_I2C_free(Sensor* sensor); - -#endif \ No newline at end of file diff --git a/applications/plugins/unitemp/sensors/SHT30.c b/applications/plugins/unitemp/sensors/SHT30.c deleted file mode 100644 index 700a54dec..000000000 --- a/applications/plugins/unitemp/sensors/SHT30.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - Unitemp - Universal temperature reader - Copyright (C) 2022 Victor Nikitchuk (https://github.com/quen0n) - - 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 . -*/ -#include "SHT30.h" -#include "../interfaces/I2CSensor.h" - -const SensorType SHT30 = { - .typename = "SHT30", - .altname = "SHT30/31/35", - .interface = &I2C, - .datatype = UT_TEMPERATURE | UT_HUMIDITY, - .pollingInterval = 1000, - .allocator = unitemp_SHT30_I2C_alloc, - .mem_releaser = unitemp_SHT30_I2C_free, - .initializer = unitemp_SHT30_init, - .deinitializer = unitemp_SHT30_I2C_deinit, - .updater = unitemp_SHT30_I2C_update}; -const SensorType GXHT30 = { - .typename = "GXHT30", - .altname = "GXHT30/31/35", - .interface = &I2C, - .datatype = UT_TEMPERATURE | UT_HUMIDITY, - .pollingInterval = 1000, - .allocator = unitemp_SHT30_I2C_alloc, - .mem_releaser = unitemp_SHT30_I2C_free, - .initializer = unitemp_GXHT30_init, - .deinitializer = unitemp_SHT30_I2C_deinit, - .updater = unitemp_SHT30_I2C_update}; - -bool unitemp_SHT30_I2C_alloc(Sensor* sensor, char* args) { - UNUSED(args); - I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance; - - //Адреса на шине I2C (7 бит) - i2c_sensor->minI2CAdr = 0x44 << 1; - i2c_sensor->maxI2CAdr = 0x45 << 1; - return true; -} - -bool unitemp_SHT30_I2C_free(Sensor* sensor) { - //Нечего высвобождать, так как ничего не было выделено - UNUSED(sensor); - return true; -} - -bool unitemp_SHT30_init(Sensor* sensor) { - UNUSED(sensor); - return true; -} - -bool unitemp_GXHT30_init(Sensor* sensor) { - I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance; - //Включение режима автоматического преобразования 2 раза в сек - uint8_t data[2] = {0x22, 0x36}; - if(!unitemp_i2c_writeArray(i2c_sensor, 2, data)) return false; - return true; -} - -bool unitemp_SHT30_I2C_deinit(Sensor* sensor) { - //Нечего деинициализировать - UNUSED(sensor); - return true; -} - -UnitempStatus unitemp_SHT30_I2C_update(Sensor* sensor) { - I2CSensor* i2c_sensor = (I2CSensor*)sensor->instance; - //Получение данных - uint8_t data[6] = {0xE0, 0x00}; - if(!unitemp_i2c_writeArray(i2c_sensor, 2, data)) return UT_SENSORSTATUS_TIMEOUT; - if(!unitemp_i2c_readArray(i2c_sensor, 6, data)) return UT_SENSORSTATUS_TIMEOUT; - - sensor->temp = -45 + 175 * (((uint16_t)(data[0] << 8) | data[1]) / 65535.0f); - sensor->hum = 100 * (((uint16_t)(data[3] << 8) | data[4]) / 65535.0f); - - return UT_SENSORSTATUS_OK; -} diff --git a/applications/plugins/unitemp/sensors/SHT30.h b/applications/plugins/unitemp/sensors/SHT30.h deleted file mode 100644 index 93e9d05f2..000000000 --- a/applications/plugins/unitemp/sensors/SHT30.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Unitemp - Universal temperature reader - Copyright (C) 2022 Victor Nikitchuk (https://github.com/quen0n) - - 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 . -*/ -#ifndef UNITEMP_SHT30 -#define UNITEMP_SHT30 - -#include "../unitemp.h" -#include "../Sensors.h" -extern const SensorType SHT30; -extern const SensorType GXHT30; -/** - * @brief Выделение памяти и установка начальных значений датчика SHT30 - * - * @param sensor Указатель на создаваемый датчик - * @return Истина при успехе - */ -bool unitemp_SHT30_I2C_alloc(Sensor* sensor, char* args); - -/** - * @brief Инициализации датчика SHT30 - * - * @param sensor Указатель на датчик - * @return Истина если инициализация упспешная - */ -bool unitemp_SHT30_init(Sensor* sensor); -/** - * @brief Инициализации датчика GXHT30 - * - * @param sensor Указатель на датчик - * @return Истина если инициализация упспешная - */ -bool unitemp_GXHT30_init(Sensor* sensor); - -/** - * @brief Деинициализация датчика - * - * @param sensor Указатель на датчик - */ -bool unitemp_SHT30_I2C_deinit(Sensor* sensor); - -/** - * @brief Обновление значений из датчика - * - * @param sensor Указатель на датчик - * @return Статус обновления - */ -UnitempStatus unitemp_SHT30_I2C_update(Sensor* sensor); - -/** - * @brief Высвободить память датчика - * - * @param sensor Указатель на датчик - */ -bool unitemp_SHT30_I2C_free(Sensor* sensor); - -#endif \ No newline at end of file diff --git a/applications/plugins/unitemp/sensors/Sensors.xlsx b/applications/plugins/unitemp/sensors/Sensors.xlsx index b139b1b00722c1c505ebb46541ba194caeddd262..2b6578e0ecc66d8bd41e911ea600061bc3c70de0 100644 GIT binary patch delta 5116 zcmZ8lcRbu*vtESgz1vlnV685C?={gyi5^7nCHRI!U43<;_ZB5Ot40YCLL|xxqW3N# zxcTM2_rCYN=b!oG%=4Lf&Y3f3X0|QAnb*(b-~ru6qPbWgkPq?)4ir%OkitXYNu6$A zh|!1;{>Z_HgQ-&F(obHQVzB4aK(a3ql+0**sRGfsRi9N}dFDJ)GQuJoDs)QZd+Vle zJWG)lizm}^OxFni;H}G#qFrEe7kbbLFU8|iV;6%gd@`6jy2bP(te1jrdL-lOi$hE@REM5(8>|FAg#djsE^cs)GIr- ztCs7lbaV;Tl$<5}NwJ@!Zz#UG_F9!|uK5g+oK$1%_9pR6%Z?Pv+=FG*7Te9;!^#yZ z#qwJqd}!g#y|Uus=job-N|m2L^ZV*dzY>!X$JL}R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{b!ye3X$UDb}zjVvMp3rkCX4Qt; z{@>#?5a?|07@@`+)>lhm()DcJxq7_n_at9btldfKm1tnIY{hJa{j{E<^lc^Eqfj<8 zZ3Zf77>RI)&g~jlkk_G}DQusQY^tZq%F9t`&!DZ{4J@21k=N3{p3iO3UQUbZ+#63S zJTgBGBSvu$2eT$E%0>&HhAMOlspk^~CGL^Vm#4HD@QKM%E;_%E30ti6q`8;K6lv*_ zc#5)_2Q$m`2V0K~c#fM(H++a{I>k>4LqsQm5>nemgt>)Y+|5*rvRC#FBo%mM=19U4 zriKphPDbCJGhJLKyB>^F=|+W#B4RHhT*uXiic}hRUhchKbp;;~tAmsq^IYRT)2u=K zZsb)OC!TH)-T&w)i?P;lpAle<8pYgvoVE9o1$lZL&VtRebsu zr+iBs!NRYYt!%>COUvg}J;l8gx8`>XqM|$pTtJ&vJtv9wg;g$y|90u)uzet5Tf%|7 zLv0US91lI>;ox}h;mkm|rP={~s=L`oU2VvoA2x9R*TSu+-@a7cZGYXuwoNB{##-=~ zjo>A&4u_PYDFMy&HJIw_A24!)p+J}&M@w?wsZ32;F=kSN0sI!uD-o~v0BC%U$nX$2 z0v75innrV_jm3jU>V-mH(B-J8r(4r@(!OsVEs#Yu*CQiX;!(P|<`p1ez1yNQhnq_wIwV3vCjYw95-`PyAZx5>V;eBDm z&;%cG1?b08S28x|)7`SX*q@b*`Mk@+_K=cMTf*ns7hRcg~udsO%#{xt4L*GLG)-;y9>iGX_a#pYT-Zez9P1&-4>X2jmpS>cJ%V7?zp=*y01|)z0QLWYsq$bC1m%D~_^={EFro^? Hzrz0ktF0{W diff --git a/applications/plugins/unitemp/views/General_view.c b/applications/plugins/unitemp/views/General_view.c index fc1408b1a..e21b04de2 100644 --- a/applications/plugins/unitemp/views/General_view.c +++ b/applications/plugins/unitemp/views/General_view.c @@ -362,8 +362,7 @@ static void _draw_carousel_info(Canvas* canvas) { BUFF_SIZE, "0x%02X", ((I2CSensor*)unitemp_sensor_getActive(generalview_sensor_index)->instance) - ->currentI2CAdr >> - 1); + ->currentI2CAdr); canvas_draw_str(canvas, 57, 35, app->buff); canvas_draw_str(canvas, 54, 46, "15 (C0)"); canvas_draw_str(canvas, 54, 58, "16 (C1)"); diff --git a/applications/plugins/unitemp/views/SensorEdit_view.c b/applications/plugins/unitemp/views/SensorEdit_view.c index d1660bc2e..4d5bc17db 100644 --- a/applications/plugins/unitemp/views/SensorEdit_view.c +++ b/applications/plugins/unitemp/views/SensorEdit_view.c @@ -214,9 +214,9 @@ static void _gpio_change_callback(VariableItem* item) { static void _i2caddr_change_callback(VariableItem* item) { uint8_t index = variable_item_get_current_value_index(item); ((I2CSensor*)editable_sensor->instance)->currentI2CAdr = - ((I2CSensor*)editable_sensor->instance)->minI2CAdr + index * 2; + ((I2CSensor*)editable_sensor->instance)->minI2CAdr + index; char buff[5]; - snprintf(buff, 5, "0x%2X", ((I2CSensor*)editable_sensor->instance)->currentI2CAdr >> 1); + snprintf(buff, 5, "0x%2X", ((I2CSensor*)editable_sensor->instance)->currentI2CAdr); variable_item_set_current_value_text(item, buff); } /** @@ -335,15 +335,11 @@ void unitemp_SensorEdit_switch(Sensor* sensor) { VariableItem* item = variable_item_list_add( variable_item_list, "I2C address", - (((I2CSensor*)sensor->instance)->maxI2CAdr >> 1) - - (((I2CSensor*)sensor->instance)->minI2CAdr >> 1) + 1, + ((I2CSensor*)sensor->instance)->maxI2CAdr - ((I2CSensor*)sensor->instance)->minI2CAdr + + 1, _i2caddr_change_callback, app); - snprintf(app->buff, 5, "0x%2X", ((I2CSensor*)sensor->instance)->currentI2CAdr >> 1); - variable_item_set_current_value_index( - item, - (((I2CSensor*)sensor->instance)->currentI2CAdr >> 1) - - (((I2CSensor*)sensor->instance)->minI2CAdr >> 1)); + snprintf(app->buff, 5, "0x%2X", ((I2CSensor*)sensor->instance)->currentI2CAdr); variable_item_set_current_value_text(item, app->buff); } diff --git a/applications/plugins/unitemp/views/Widgets_view.c b/applications/plugins/unitemp/views/Widgets_view.c index 892b31f98..6d8702ca1 100644 --- a/applications/plugins/unitemp/views/Widgets_view.c +++ b/applications/plugins/unitemp/views/Widgets_view.c @@ -132,7 +132,7 @@ void unitemp_widget_delete_switch(Sensor* sensor) { app->buff, BUFF_SIZE, "\e#I2C addr:\e# 0x%02X", - ((I2CSensor*)current_sensor->instance)->currentI2CAdr >> 1); + ((I2CSensor*)current_sensor->instance)->currentI2CAdr); widget_add_text_box_element( app->widget, 0, 28, 128, 23, AlignLeft, AlignTop, app->buff, false); }