Fix JSON error - again

Fix JSON error - again (#4108)
This commit is contained in:
Theo Arends 2018-10-20 17:28:42 +02:00
parent ee8d34abfe
commit d012ce942b

View File

@ -1,29 +1,29 @@
/** /**
* *
* @file xsns_30_mpr121.ino * @file xsns_30_mpr121.ino
* *
* @package Sonoff-Tasmota * @package Sonoff-Tasmota
* @subpackage Sensors * @subpackage Sensors
* @name MPR121 * @name MPR121
* *
* @description Driver for up to 4x Freescale MPR121 Proximity Capacitive Touch Sensor Controllers (Only touch buttons). * @description Driver for up to 4x Freescale MPR121 Proximity Capacitive Touch Sensor Controllers (Only touch buttons).
* *
* @author Rene 'Renne' Bartsch, B.Sc. Informatics, <rene@bartschnet.de> * @author Rene 'Renne' Bartsch, B.Sc. Informatics, <rene@bartschnet.de>
* @copyright Rene 'Renne' Bartsch 2018 * @copyright Rene 'Renne' Bartsch 2018
* @date $Date$ * @date $Date$
* @version $Id$ * @version $Id$
* *
* @link https://github.com/arendst/Sonoff-Tasmota/wiki/MPR121 \endlink * @link https://github.com/arendst/Sonoff-Tasmota/wiki/MPR121 \endlink
* @link https://www.sparkfun.com/datasheets/Components/MPR121.pdf \endlink * @link https://www.sparkfun.com/datasheets/Components/MPR121.pdf \endlink
* @link http://cache.freescale.com/files/sensors/doc/app_note/AN3891.pdf \endlink * @link http://cache.freescale.com/files/sensors/doc/app_note/AN3891.pdf \endlink
* @link http://cache.freescale.com/files/sensors/doc/app_note/AN3892.pdf \endlink * @link http://cache.freescale.com/files/sensors/doc/app_note/AN3892.pdf \endlink
* @link http://cache.freescale.com/files/sensors/doc/app_note/AN3893.pdf \endlink * @link http://cache.freescale.com/files/sensors/doc/app_note/AN3893.pdf \endlink
* @link http://cache.freescale.com/files/sensors/doc/app_note/AN3894.pdf \endlink * @link http://cache.freescale.com/files/sensors/doc/app_note/AN3894.pdf \endlink
* @link http://cache.freescale.com/files/sensors/doc/app_note/AN3895.pdf \endlink * @link http://cache.freescale.com/files/sensors/doc/app_note/AN3895.pdf \endlink
* *
* @license GNU GPL v.3 * @license GNU GPL v.3
*/ */
/* /*
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -178,9 +178,9 @@
/** /**
* MPR121 sensors status and data struct. * MPR121 sensors status and data struct.
* *
* The struct mpr121 uses the indices of i2c_addr and id to link the specific sensors to an I2C address and a human-readable ID * The struct mpr121 uses the indices of i2c_addr and id to link the specific sensors to an I2C address and a human-readable ID
* and the indices of the arrays connected, running, current and previous to store sensor status and data of a specific sensor. * and the indices of the arrays connected, running, current and previous to store sensor status and data of a specific sensor.
* *
*/ */
typedef struct mpr121 mpr121; typedef struct mpr121 mpr121;
struct mpr121 { struct mpr121 {
@ -195,12 +195,12 @@ struct mpr121 {
/** /**
* The function Mpr121Init() soft-resets, detects and configures up to 4x MPR121 sensors. * The function Mpr121Init() soft-resets, detects and configures up to 4x MPR121 sensors.
* *
* @param struct *pS Struct with MPR121 status and data. * @param struct *pS Struct with MPR121 status and data.
* @return void * @return void
* @pre None. * @pre None.
* @post None. * @post None.
* *
*/ */
void Mpr121Init(struct mpr121 *pS) void Mpr121Init(struct mpr121 *pS)
{ {
@ -301,16 +301,16 @@ void Mpr121Init(struct mpr121 *pS)
/** /**
* Publishes the sensor information. * Publishes the sensor information.
* *
* The function Mpr121Show() reads sensor data, checks for over-current exceptions and * The function Mpr121Show() reads sensor data, checks for over-current exceptions and
* creates strings with button states for the web-interface and near real-time/ telemetriy MQTT. * creates strings with button states for the web-interface and near real-time/ telemetriy MQTT.
* *
* @param struct *pS Struct with MPR121 status and data. * @param struct *pS Struct with MPR121 status and data.
* @param byte function Tasmota function ID. * @param byte function Tasmota function ID.
* @return void * @return void
* @pre Call Mpr121Init() once. * @pre Call Mpr121Init() once.
* @post None. * @post None.
* *
*/ */
void Mpr121Show(struct mpr121 *pS, byte function) void Mpr121Show(struct mpr121 *pS, byte function)
{ {
@ -365,7 +365,7 @@ void Mpr121Show(struct mpr121 *pS, byte function)
// Append JSON message string // Append JSON message string
if (FUNC_JSON_APPEND == function) { if (FUNC_JSON_APPEND == function) {
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"Button%i\":%i"), mqtt_data, (i > 0 ? "," : ""), j, BITC(i, j)); snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s%s\"Button%i\":%i"), mqtt_data, (j > 0 ? "," : ""), j, BITC(i, j));
} }
} // for-loop j } // for-loop j
@ -392,18 +392,18 @@ void Mpr121Show(struct mpr121 *pS, byte function)
/** /**
* The function Xsns30() interfaces Tasmota with the driver. * The function Xsns30() interfaces Tasmota with the driver.
* *
* It provides the function IDs * It provides the function IDs
* FUNC_INIT to initialize a driver, * FUNC_INIT to initialize a driver,
* FUNC_EVERY_50_MSECOND for near real-time operation, * FUNC_EVERY_50_MSECOND for near real-time operation,
* FUNC_JSON_APPEND for telemetry data and * FUNC_JSON_APPEND for telemetry data and
* FUNC_WEB_APPEND for displaying data in the Tasmota web-interface * FUNC_WEB_APPEND for displaying data in the Tasmota web-interface
* *
* @param byte function Tasmota function ID. * @param byte function Tasmota function ID.
* @return boolean ??? * @return boolean ???
* @pre None. * @pre None.
* @post None. * @post None.
* *
*/ */
boolean Xsns30(byte function) boolean Xsns30(byte function)
{ {