Add flowmeter (YF-DN50 and similary)

This commit is contained in:
Norbert Richter 2022-04-22 08:40:29 +02:00
parent 5a03fbaa92
commit d7d71cd9c8
No known key found for this signature in database
GPG Key ID: 6628701A626FA674
33 changed files with 476 additions and 26 deletions

View File

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
- Command ``EnergyExportActive<phase>`` to (p)reset energy export active for supported devices. Currently ADE7880 only (#13515)
- Sonoff SPM delayed SetPowerOnState (#13447)
- Command ``SetOption139 0/1`` to switch between pressure unit "mmHg" (0) or "inHg" (1) when ``SO24 1`` (#15350)
- Support for flow meter
### Changed

View File

@ -73,6 +73,7 @@ const be_const_member_t lv_gpio_constants[] = {
{ "ETH_PHY_POWER", (int32_t) GPIO_ETH_PHY_POWER },
{ "EXS_ENABLE", (int32_t) GPIO_EXS_ENABLE },
{ "FALLING", FALLING },
{ "FLOWMETER_SIGNAL", (int32_t) GPIO_FLOWMETER_IN },
{ "FTC532", (int32_t) GPIO_FTC532 },
{ "GPS_RX", (int32_t) GPIO_GPS_RX },
{ "GPS_TX", (int32_t) GPIO_GPS_TX },

View File

@ -225,6 +225,7 @@
#define D_JSON_RESETTABLE_TOTAL_ACTIVE "ResetTotalActive"
#define D_JSON_SIGNALSTRENGTH "SignalStrength"
#define D_JSON_CHIPTEMPERATURE "ChipTemperature"
#define D_JSON_FLOW_UNIT "FLowUnit"
#define D_RSLT_ENERGY "ENERGY"
#define D_RSLT_HASS_STATE "HASS_STATE"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Wagwoord geverifieer" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Fout" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Грешка" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Neue Adresse"
#define D_OUT_OF_RANGE "Außerhalb Bereich"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Übereinstimmung" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Fehler" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -866,6 +866,7 @@
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Cambiando dirección a"
#define D_OUT_OF_RANGE "Fuera de Rango"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Clave Correcta" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Positionner l'adresse à"
#define D_OUT_OF_RANGE "Hors limites"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Mot-de-passe vérifié" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Erreur" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -913,6 +913,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1056,10 @@
#define D_FP_PASSVERIFY "Jelszó ellenőrizve" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Hiba" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -913,6 +913,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Imposta indirizzo a"
#define D_OUT_OF_RANGE "Fuori intervallo"
@ -1054,6 +1056,10 @@
#define D_FP_PASSVERIFY "Password verificata" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Errore" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Nieuw adres"
#define D_OUT_OF_RANGE "Buiten beriek"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Wachtwoord herkend" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Fout" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Ustawiam adres na"
#define D_OUT_OF_RANGE "Poza zakresem"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Zweryfikowano poprawnie" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Błąd" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "W/h"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Mudança de endereço para"
#define D_OUT_OF_RANGE "Fora de Alcance"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Senha verificada" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Erro" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Mudança de endereço para"
#define D_OUT_OF_RANGE "Fora de Alcance"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "А"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "Вт"
#define D_UNIT_WATTHOUR "ВтЧ"
#define D_UNIT_WATT_METER_QUADRAT "Вт/м²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "А"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "Вт"
#define D_UNIT_WATTHOUR "Вт/г"
#define D_UNIT_WATT_METER_QUADRAT "Вт/м²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "A"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "W"
#define D_UNIT_WATTHOUR "Wh"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -865,7 +865,8 @@
#define D_GPIO_SHIFT595_OE "74x595 OE"
#define D_GPIO_SHIFT595_SER "74x595 SER"
#define D_SENSOR_CM11_TX "CM110x TX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_CM11_RX "CM110x RX"
#define D_SENSOR_FLOWMETER "Flowmeter"
// Units
#define D_UNIT_AMPERE "安培"
@ -913,6 +914,8 @@
#define D_UNIT_WATT "瓦特"
#define D_UNIT_WATTHOUR "瓦小時"
#define D_UNIT_WATT_METER_QUADRAT "W/m²"
#define D_UNIT_LITER_PER_MINUTE "l/min"
#define D_UNIT_CUBICMETER_PER_HOUR "m³/h"
#define D_NEW_ADDRESS "Setting address to"
#define D_OUT_OF_RANGE "Out of Range"
@ -1054,6 +1057,10 @@
#define D_FP_PASSVERIFY "Password verified" // 0x21 Verify the fingerprint passed
#define D_FP_UNKNOWNERROR "Error" // Any other error
// xsns_96_flowmeter.ino
#define D_FLOWMETER_NAME "Flowmeter"
#define D_FLOWMETER_RATE "Rate"
// xsns_83_neopool.ino
#define D_NEOPOOL_MACH_NONE "NeoPool" // Machine names
#define D_NEOPOOL_MACH_HIDROLIFE "Hidrolife"

View File

@ -351,7 +351,7 @@ typedef union {
uint8_t data;
struct {
uint8_t spare0 : 1;
uint8_t spare1 : 1;
uint8_t flowmeter_unit : 1; // Sensor96 9,x - unit l/min (0) or m³/h (1)
uint8_t bh1750_2_resolution : 2;
uint8_t bh1750_1_resolution : 2; // Sensor10 1,2,3
uint8_t hx711_json_weight_change : 1; // Sensor34 8,x - Enable JSON message on weight change
@ -779,10 +779,10 @@ typedef struct {
uint8_t tcp_config; // F5F
uint8_t light_step_pixels; // F60
uint8_t free_f61[27]; // F61 - Decrement if adding new Setting variables just above and below
uint8_t free_f61[23]; // F61 - Decrement if adding new Setting variables just above and below
// Only 32 bit boundary variables below
uint16_t flowmeter_calibration[2]; // F78
int32_t energy_kWhexport_ph[3]; // F7C
uint32_t eth_ipv4_address[5]; // F88
uint32_t energy_kWhtotal; // F9C

View File

@ -187,6 +187,7 @@ enum UserSelectablePins {
GPIO_RESET, // Generic reset
GPIO_MS01, // Sonoff MS01 Moisture Sensor 1wire interface
GPIO_SDIO_CMD, GPIO_SDIO_CLK, GPIO_SDIO_D0, GPIO_SDIO_D1, GPIO_SDIO_D2, GPIO_SDIO_D3, // SD Card SDIO interface, including 1-bit and 4-bit modes
GPIO_FLOWMETER_IN, // Flow Meter Pin
GPIO_SENSOR_END };
enum ProgramSelectablePins {
@ -418,12 +419,14 @@ const char kSensorNames[] PROGMEM =
D_SENSOR_SDIO_D1 "|"
D_SENSOR_SDIO_D2 "|"
D_SENSOR_SDIO_D3 "|"
D_SENSOR_FLOWMETER "|"
;
const char kSensorNamesFixed[] PROGMEM =
D_SENSOR_USER;
#define MAX_MAX31865S 6
#define MAX_FLOWMETER 2
#define MAX_A4988_MSS 3
#define MAX_WEBCAM_DATA 8
#define MAX_WEBCAM_HSD 3
@ -973,6 +976,11 @@ const uint16_t kGpioNiceList[] PROGMEM = {
AGPIO(GPIO_CM11_TXD), // CM110x Serial interface
AGPIO(GPIO_CM11_RXD), // CM110x Serial interface
#endif
#if defined(USE_FLOWMETER)
AGPIO(GPIO_FLOWMETER_IN) + MAX_FLOWMETER, // Flow meter Pin
#endif
/*-------------------------------------------------------------------------------------------*\
* ESP32 specifics
\*-------------------------------------------------------------------------------------------*/

View File

@ -0,0 +1,257 @@
/*
xsns_96_flowmeter.ino - flowmeter support for Tasmota
Up to two flowmeter YF-DN50 and similary supported
(f = 1 Hz up to 5 kHz)
Copyright (C) 2022 Norbert Richter
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/>.
*/
#ifdef USE_FLOWMETER
#define XSNS_96 96
#define FLOWMETER_WEIGHT_AVG_SAMPLE 20 // samples
#define FLOWMETER_MIN_FREQ 1 // Hz
// The Arduino standard GPIO routines are not enough,
// must use some from the Espressif SDK as well
extern "C" {
#include "gpio.h"
}
#ifdef USE_WEBSERVER
const char HTTP_SNS_FLOWMETER[] PROGMEM =
"{s}" D_FLOWMETER_NAME "-%d " D_FLOWMETER_RATE "{m}%*_f %s{e}"
;
#endif // USE_WEBSERVER
int32_t flowmeter_period[MAX_FLOWMETER] = {0};
float flowmeter_period_avg[MAX_FLOWMETER] = {0};
uint32_t flowmeter_count[MAX_FLOWMETER] = {0};
volatile uint32_t flowmeter_last_irq[MAX_FLOWMETER] = {0};
bool flowmeter_valuesread = false;
void IRAM_ATTR FlowMeterIR(uint16_t irq)
{
uint32_t gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS);
GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, gpio_status);
uint32_t time = micros();
uint32_t i = irq;
if (irq < MAX_FLOWMETER) {
if ((time - flowmeter_last_irq[i]) < (1000000 / FLOWMETER_MIN_FREQ)) {
flowmeter_period[i] = time - flowmeter_last_irq[i];
} else {
flowmeter_period[i] = 0;
}
flowmeter_valuesread = true;
flowmeter_last_irq[i] = time;
}
}
// GPIO_STATUS is always 0 (?), so can only determine the IR source using this way:
void IRAM_ATTR FlowMeter1IR(void)
{
FlowMeterIR(0);
}
void IRAM_ATTR FlowMeter2IR(void)
{
FlowMeterIR(1);
}
void FlowMeterRead(void)
{
for (uint32_t i = 0; i < MAX_FLOWMETER; i++) {
if ((micros() - flowmeter_last_irq[i]) >= (1000000 / FLOWMETER_MIN_FREQ)) {
flowmeter_period[i] = 0;
flowmeter_period_avg[i] = 0;
}
// exponentially weighted average
if (flowmeter_count[i] <= FLOWMETER_WEIGHT_AVG_SAMPLE) {
flowmeter_count[i]++;
}
flowmeter_period_avg[i] -= flowmeter_period_avg[i] / flowmeter_count[i];
flowmeter_period_avg[i] += float(flowmeter_period[i]) / flowmeter_count[i];
}
}
void FlowMeterInit(void)
{
void (* irq_service[MAX_FLOWMETER])(void)= {FlowMeter1IR, FlowMeter2IR};
flowmeter_valuesread = false;
for (uint32_t i = 0; i < MAX_FLOWMETER; i++) {
pinMode(Pin(GPIO_FLOWMETER_IN, i), INPUT);
attachInterrupt(Pin(GPIO_FLOWMETER_IN, i), irq_service[i], RISING);
}
}
void FlowMeterShow(bool json)
{
for (uint32_t i = 0; i < MAX_FLOWMETER; i++) {
float flowmeter_period_float = 0;
float flowmeter_rate_float = 0;
float flowmeter_period_avg_float = 0;
float flowmeter_rate_avg_float = 0;
float flowmeter_factor = 1.0;
float flowmeter_unit_factor = Settings->SensorBits1.flowmeter_unit ? 500 : 8333;;
if (Settings->flowmeter_calibration[i]) {
flowmeter_factor = (float)Settings->flowmeter_calibration[i] / 1000;
}
if (flowmeter_period[i]) {
flowmeter_period_float = (float)flowmeter_period[i] / 1000;
flowmeter_period_avg_float = flowmeter_period_avg[i] / 1000;
flowmeter_rate_float = flowmeter_unit_factor / (float)flowmeter_period[i] * (flowmeter_factor * 1000);
flowmeter_rate_avg_float = flowmeter_unit_factor / flowmeter_period_avg[i] * (flowmeter_factor * 1000);
}
if (PinUsed(GPIO_FLOWMETER_IN, i)) {
if (json) {
ResponseAppend_P(PSTR(",\"" D_FLOWMETER_NAME "-%d\":{\"" D_JSON_PERIOD "\":%*_f,\"" D_JSON_FLOWRATE "\":%*_f}"),
i+1,
Settings->flag2.frequency_resolution, &flowmeter_period_float,
Settings->flag2.frequency_resolution, &flowmeter_rate_avg_float
);
#ifdef USE_WEBSERVER
} else {
WSContentSend_PD(HTTP_SNS_FLOWMETER,
i+1,
Settings->flag2.frequency_resolution, &flowmeter_rate_avg_float,
Settings->SensorBits1.flowmeter_unit ? D_UNIT_CUBICMETER_PER_HOUR : D_UNIT_LITER_PER_MINUTE
);
#endif // USE_WEBSERVER
}
}
if (json) {
ResponseAppend_P(PSTR(",\"" D_JSON_FLOW_UNIT "\":\"%s\""),
Settings->SensorBits1.flowmeter_unit ? D_UNIT_CUBICMETER_PER_HOUR : D_UNIT_LITER_PER_MINUTE
);
}
}
}
/*********************************************************************************************\
* Supported commands for Sensor96:
*
* Sensor96 - Show current settings
* Sensor96 1 <correction-factor> - Set sensor 1 factor (x 1000) - to set to 0.2 enter 'Sensor96 1 200'
* Sensor96 2 <correction-factor> - Set sensor 2 factor (x 1000)
* Sensor96 9 0|1 - Show flow value in l/min (0) or m³/h (1)
*
* Flowmeter calibration:
* - get the current displayed flow rate (D)
* - get the current <correction-factor> (c)
* - measure the real flow rate (M)
* - new <correction-factor> = M / (c * D)
*
* Example:
* - displayed flow rate = 254.39 l/min (D)
* - current <correction-factor> = 1.0 (c)
* - real flow rate = 83.42 l/min (M)
*
* new <correction-factor> = M / (c * D) = 83.42 / (1 * 254.39) = 0.328
* Cmd: Sensor96 x 328
\*********************************************************************************************/
bool FlowMeterCommand(void) {
bool show_parms = true;
char argument[XdrvMailbox.data_len];
long value = 0;
for (uint32_t ca = 0; ca < XdrvMailbox.data_len; ca++) {
if ((' ' == XdrvMailbox.data[ca]) || ('=' == XdrvMailbox.data[ca])) { XdrvMailbox.data[ca] = ','; }
}
bool any_value = (strchr(XdrvMailbox.data, ',') != nullptr);
if (any_value) {
value = strtol(ArgV(argument, 2), nullptr, 10);
}
switch (XdrvMailbox.payload) {
case 1: // Calibration value
case 2: // Calibration value
if (any_value) {
Settings->flowmeter_calibration[XdrvMailbox.payload - 1] = value;
ResponseCmndNumber(value);
show_parms = false;
}
break;
case 9: // Unit
if (any_value) {
Settings->SensorBits1.flowmeter_unit = value & 1;
ResponseCmndNumber(value & 1);
show_parms = false;
}
break;
}
if (show_parms) {
Response_P(PSTR("{\"Sensor%d\":{"), XSNS_96);
for (uint32_t i = 0; i < MAX_FLOWMETER; i++) {
float flowmeter_factor = Settings->flowmeter_calibration[i] ? (float)Settings->flowmeter_calibration[i] / 1000 : 1.0;
ResponseAppend_P(PSTR("\"" D_JSON_POWERFACTOR "-%d\":%3_f,"), i+1, &flowmeter_factor);
}
ResponseAppend_P(PSTR("\"" D_JSON_FLOW_UNIT "\":\"%s\"}}"),
Settings->SensorBits1.flowmeter_unit ? D_UNIT_CUBICMETER_PER_HOUR : D_UNIT_LITER_PER_MINUTE
);
}
return true;
}
/*********************************************************************************************\
* Interface
\*********************************************************************************************/
bool Xsns96(uint8_t function)
{
bool result = false;
if (PinUsed(GPIO_FLOWMETER_IN, GPIO_ANY)) {
switch (function) {
case FUNC_INIT:
FlowMeterInit();
break;
case FUNC_EVERY_250_MSECOND:
FlowMeterRead();
break;
case FUNC_COMMAND_SENSOR:
if (XSNS_96 == XdrvMailbox.index) {
result = FlowMeterCommand();
}
break;
case FUNC_JSON_APPEND:
FlowMeterShow(true);
break;
#ifdef USE_WEBSERVER
case FUNC_WEB_SENSOR:
FlowMeterShow(false);
break;
#endif // USE_WEBSERVER
}
}
return result;
}
#endif // USE_FLOWMETER

View File

@ -299,4 +299,6 @@ BL6523_RX = GPIO_BL6523_RX
ADE7880_IRQ = GPIO_ADE7880_IRQ
RESET = GPIO_RESET
FLOWMETER_SIGNAL = GPIO_FLOWMETER_IN
SENSOR_END = GPIO_SENSOR_END