mirror of https://github.com/arendst/Tasmota.git
Merge pull request #8605 from device111/development
AS3935, add stage to json, fix overwrite nf-floor
This commit is contained in:
commit
61b47e345d
|
@ -147,6 +147,7 @@
|
|||
#define D_JSON_SPEED "Speed"
|
||||
#define D_JSON_SPEED_UNIT "SpeedUnit"
|
||||
#define D_JSON_SSID "SSId"
|
||||
#define D_JSON_STAGE "Stage"
|
||||
#define D_JSON_STARTDST "StartDST" // Start Daylight Savings Time
|
||||
#define D_JSON_STARTED "Started"
|
||||
#define D_JSON_STARTUPUTC "StartupUTC"
|
||||
|
|
|
@ -51,8 +51,6 @@
|
|||
#define INDOORS 0x24
|
||||
#define OUTDOORS 0x1C
|
||||
|
||||
|
||||
|
||||
// Global
|
||||
const char HTTP_SNS_UNIT_KILOMETER[] PROGMEM = D_UNIT_KILOMETER;
|
||||
// Http
|
||||
|
@ -78,7 +76,7 @@ const char HTTP_SNS_AS3935_INTNOEV[] PROGMEM = "{s}%s: " D_AS3935_INTNOEV "{e}";
|
|||
const char HTTP_SNS_AS3935_MSG[] PROGMEM = "{s}%s: " D_AS3935_LIGHT " " D_AS3935_APRX " %d " D_UNIT_KILOMETER " " D_AS3935_AWAY "{e}";
|
||||
const char* const HTTP_SNS_AS3935_TABLE_1[] PROGMEM = { HTTP_SNS_AS3935_EMPTY, HTTP_SNS_AS3935_MSG, HTTP_SNS_AS3935_OUT, HTTP_SNS_AS3935_NOT, HTTP_SNS_AS3935_ABOVE, HTTP_SNS_AS3935_NOISE, HTTP_SNS_AS3935_DISTURB, HTTP_SNS_AS3935_INTNOEV };
|
||||
// Json
|
||||
const char JSON_SNS_AS3935_EVENTS[] PROGMEM = ",\"%s\":{\"" D_JSON_EVENT "\":%d,\"" D_JSON_DISTANCE "\":%d,\"" D_JSON_ENERGY "\":%u}";
|
||||
const char JSON_SNS_AS3935_EVENTS[] PROGMEM = ",\"%s\":{\"" D_JSON_EVENT "\":%d,\"" D_JSON_DISTANCE "\":%d,\"" D_JSON_ENERGY "\":%u,\"" D_JSON_STAGE "\":%d}";
|
||||
// Json Command
|
||||
const char* const S_JSON_AS3935_COMMAND_ONOFF[] PROGMEM = {"\"" D_AS3935_OFF "\"","\"" D_AS3935_ON"\""};
|
||||
const char* const S_JSON_AS3935_COMMAND_GAIN[] PROGMEM = {"\"" D_AS3935_INDOORS "\"", "\"" D_AS3935_OUTDOORS "\""};
|
||||
|
@ -473,9 +471,6 @@ void AS3935InitSettings() {
|
|||
AS3935SetGain(INDOORS);
|
||||
AS3935SetNoiseFloor(Settings.as3935_parameter.nf_autotune_min);
|
||||
}
|
||||
} else {
|
||||
AS3935SetGain(INDOORS);
|
||||
AS3935SetNoiseFloor(0);
|
||||
}
|
||||
}
|
||||
I2cWrite8(AS3935_ADDR, 0x00, Settings.as3935_sensor_cfg[0]);
|
||||
|
@ -756,8 +751,10 @@ bool AS3935Cmd(void) {
|
|||
void AH3935Show(bool json)
|
||||
{
|
||||
if (json) {
|
||||
ResponseAppend_P(JSON_SNS_AS3935_EVENTS, D_SENSOR_AS3935, as3935_sensor.mqtt_irq, as3935_sensor.distance, as3935_sensor.intensity );
|
||||
|
||||
uint16_t vrms;
|
||||
uint8_t stage;
|
||||
AS3935CalcVrmsLevel(vrms, stage);
|
||||
ResponseAppend_P(JSON_SNS_AS3935_EVENTS, D_SENSOR_AS3935, as3935_sensor.mqtt_irq, as3935_sensor.distance, as3935_sensor.intensity, stage);
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
uint8_t gain = AS3935GetGainInt();
|
||||
|
|
Loading…
Reference in New Issue