mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 04:36:31 +00:00
Fix QMC5883 and HLC5883 drivers breaking sensor command (#20585)
* fix breaking sensor command * fix hmc5883
This commit is contained in:
parent
559789b4ec
commit
ab49593f9f
@ -261,6 +261,7 @@ bool Ina3221CmndSensor(void)
|
|||||||
{
|
{
|
||||||
int argc = ArgC();
|
int argc = ArgC();
|
||||||
if(argc != 1 && argc != 4) {
|
if(argc != 1 && argc != 4) {
|
||||||
|
AddLog(LOG_LEVEL_DEBUG, PSTR(D_INA3221 ": Not enough arguments (1 or 4)"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +224,8 @@ bool HMC5883L_Command() {
|
|||||||
bool Xsns101(uint32_t function) {
|
bool Xsns101(uint32_t function) {
|
||||||
if (!I2cEnabled(XI2C_73)) { return false; }
|
if (!I2cEnabled(XI2C_73)) { return false; }
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
if (FUNC_INIT == function) {
|
if (FUNC_INIT == function) {
|
||||||
HMC5883L_Init();
|
HMC5883L_Init();
|
||||||
}
|
}
|
||||||
@ -231,7 +233,7 @@ bool Xsns101(uint32_t function) {
|
|||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_COMMAND_SENSOR:
|
case FUNC_COMMAND_SENSOR:
|
||||||
if (XSNS_101 == XdrvMailbox.index) {
|
if (XSNS_101 == XdrvMailbox.index) {
|
||||||
return HMC5883L_Command(); // Return true on success
|
result = HMC5883L_Command(); // Return true on success
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FUNC_JSON_APPEND:
|
case FUNC_JSON_APPEND:
|
||||||
@ -247,7 +249,7 @@ bool Xsns101(uint32_t function) {
|
|||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return result;
|
||||||
}
|
}
|
||||||
#endif // USE_HMC5883L
|
#endif // USE_HMC5883L
|
||||||
#endif // USE_I2C
|
#endif // USE_I2C
|
||||||
|
@ -286,11 +286,18 @@ void QMC5883L_Show(uint8_t json) {
|
|||||||
bool Xsns33(uint32_t function) {
|
bool Xsns33(uint32_t function) {
|
||||||
if (!I2cEnabled(XI2C_71)) { return false; }
|
if (!I2cEnabled(XI2C_71)) { return false; }
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
if (FUNC_INIT == function) {
|
if (FUNC_INIT == function) {
|
||||||
QMC5883L_Init();
|
QMC5883L_Init();
|
||||||
}
|
}
|
||||||
else if (QMC5883L != nullptr) {
|
else if (QMC5883L != nullptr) {
|
||||||
switch (function) {
|
switch (function) {
|
||||||
|
// case FUNC_COMMAND_SENSOR:
|
||||||
|
// if (XSNS_33 == XdrvMailbox.index) {
|
||||||
|
// result = QMC5883L_CmndSensor();
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
case FUNC_JSON_APPEND:
|
case FUNC_JSON_APPEND:
|
||||||
QMC5883L_Show(1);
|
QMC5883L_Show(1);
|
||||||
break;
|
break;
|
||||||
@ -304,7 +311,7 @@ bool Xsns33(uint32_t function) {
|
|||||||
#endif // USE_WEBSERVER
|
#endif // USE_WEBSERVER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return result;
|
||||||
}
|
}
|
||||||
#endif // USE_QMC5883L
|
#endif // USE_QMC5883L
|
||||||
#endif // USE_I2C
|
#endif // USE_I2C
|
Loading…
x
Reference in New Issue
Block a user