mirror of https://github.com/arendst/Tasmota.git
6.5.0.3 Add command Sensor20
6.5.0.3 20190328 * Add command Sensor20 1..255 to change Nova Fitness SDS01 working period in minutes (#5452)
This commit is contained in:
parent
e631d49d0f
commit
e8e5d1c03c
|
@ -1,4 +1,7 @@
|
|||
/* 6.5.0.2 20190325
|
||||
/* 6.5.0.3 20190328
|
||||
* Add command Sensor20 1..255 to change Nova Fitness SDS01 working period in minutes (#5452)
|
||||
*
|
||||
* 6.5.0.2 20190325
|
||||
* Change UDP initial message handling from string to char using static memory and add debug info (#5505)
|
||||
* Add optional support for Badger HR-E Water Meter (#5539)
|
||||
*
|
||||
|
|
|
@ -330,8 +330,9 @@ struct SYSCFG {
|
|||
uint8_t rgbwwTable[5]; // 71A
|
||||
uint8_t user_template_base; // 71F
|
||||
mytmplt user_template; // 720 29 bytes
|
||||
uint8_t novasds_period; // 73D
|
||||
|
||||
uint8_t free_73D[87]; // 73D
|
||||
uint8_t free_73D[86]; // 73E
|
||||
|
||||
uint32_t drivers[3]; // 794
|
||||
uint32_t monitors; // 7A0
|
||||
|
|
|
@ -815,6 +815,8 @@ void SettingsDefaultSet2(void)
|
|||
Settings.rgbwwTable[j] = 255;
|
||||
}
|
||||
|
||||
Settings.novasds_period = WORKING_PERIOD;
|
||||
|
||||
memset(&Settings.drivers, 0xFF, 32); // Enable all possible monitors, displays, drivers and sensors
|
||||
}
|
||||
|
||||
|
@ -1055,6 +1057,9 @@ void SettingsDelta(void)
|
|||
if (Settings.version < 0x06040113) {
|
||||
Settings.param[P_RGB_REMAP] = RGB_REMAP_RGBW;
|
||||
}
|
||||
if (Settings.version < 0x06050003) {
|
||||
Settings.novasds_period = WORKING_PERIOD;
|
||||
}
|
||||
|
||||
Settings.version = VERSION;
|
||||
SettingsSave(1);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef _SONOFF_VERSION_H_
|
||||
#define _SONOFF_VERSION_H_
|
||||
|
||||
#define VERSION 0x06050002
|
||||
#define VERSION 0x06050003
|
||||
|
||||
#define D_PROGRAMNAME "Sonoff-Tasmota"
|
||||
#define D_AUTHOR "Theo Arends"
|
||||
|
|
|
@ -47,13 +47,11 @@
|
|||
#define NOVA_SDS_DEVICE_ID 0xFFFF // NodaSDS all sensor response
|
||||
#endif
|
||||
|
||||
|
||||
TasmotaSerial *NovaSdsSerial;
|
||||
|
||||
uint8_t novasds_type = 1;
|
||||
uint8_t novasds_valid = 0;
|
||||
|
||||
|
||||
struct sds011data {
|
||||
uint16_t pm100;
|
||||
uint16_t pm25;
|
||||
|
@ -126,7 +124,7 @@ bool NovaSdsCommand(uint8_t byte1, uint8_t byte2, uint8_t byte3, uint16_t sensor
|
|||
void NovaSdsSetWorkPeriod(void)
|
||||
{
|
||||
// set sensor working period
|
||||
NovaSdsCommand(NOVA_SDS_WORKING_PERIOD, NOVA_SDS_SET_MODE, WORKING_PERIOD, NOVA_SDS_DEVICE_ID, nullptr);
|
||||
NovaSdsCommand(NOVA_SDS_WORKING_PERIOD, NOVA_SDS_SET_MODE, Settings.novasds_period, NOVA_SDS_DEVICE_ID, nullptr);
|
||||
// set sensor report only on query
|
||||
NovaSdsCommand(NOVA_SDS_REPORTING_MODE, NOVA_SDS_SET_MODE, NOVA_SDS_REPORT_QUERY, NOVA_SDS_DEVICE_ID, nullptr);
|
||||
}
|
||||
|
@ -162,7 +160,22 @@ void NovaSdsSecond(void) // Every second
|
|||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
/*********************************************************************************************\
|
||||
* Command Sensor20
|
||||
*
|
||||
* 1 .. 255 - Set working period in minutes
|
||||
\*********************************************************************************************/
|
||||
|
||||
bool NovaSdsCommandSensor(void)
|
||||
{
|
||||
if ((XdrvMailbox.payload > 0) && (XdrvMailbox.payload < 256)) {
|
||||
Settings.novasds_period = XdrvMailbox.payload;
|
||||
NovaSdsSetWorkPeriod();
|
||||
}
|
||||
Response_P(S_JSON_SENSOR_INDEX_NVALUE, XSNS_20, Settings.novasds_period);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void NovaSdsInit(void)
|
||||
{
|
||||
|
@ -226,6 +239,11 @@ bool Xsns20(uint8_t function)
|
|||
case FUNC_EVERY_SECOND:
|
||||
NovaSdsSecond();
|
||||
break;
|
||||
case FUNC_COMMAND_SENSOR:
|
||||
if (XSNS_20 == XdrvMailbox.index) {
|
||||
result = NovaSdsCommandSensor();
|
||||
}
|
||||
break;
|
||||
case FUNC_JSON_APPEND:
|
||||
NovaSdsShow(1);
|
||||
break;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef USE_HRE
|
||||
/*********************************************************************************************\
|
||||
* HR-E LCD Water meter register interface
|
||||
*
|
||||
|
@ -45,8 +46,6 @@
|
|||
*
|
||||
\*********************************************************************************************/
|
||||
|
||||
#ifdef USE_HRE
|
||||
|
||||
#define XSNS_43 43
|
||||
|
||||
enum hre_states {
|
||||
|
|
Loading…
Reference in New Issue