Fix QMC5883 and HLC5883 drivers breaking sensor command (#20585)

* fix breaking sensor command

* fix hmc5883
This commit is contained in:
Barbudor 2024-01-25 08:43:56 +01:00 committed by GitHub
parent 559789b4ec
commit ab49593f9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 3 deletions

View File

@ -261,6 +261,7 @@ bool Ina3221CmndSensor(void)
{
int argc = ArgC();
if(argc != 1 && argc != 4) {
AddLog(LOG_LEVEL_DEBUG, PSTR(D_INA3221 ": Not enough arguments (1 or 4)"));
return false;
}

View File

@ -224,6 +224,8 @@ bool HMC5883L_Command() {
bool Xsns101(uint32_t function) {
if (!I2cEnabled(XI2C_73)) { return false; }
bool result = false;
if (FUNC_INIT == function) {
HMC5883L_Init();
}
@ -231,7 +233,7 @@ bool Xsns101(uint32_t function) {
switch (function) {
case FUNC_COMMAND_SENSOR:
if (XSNS_101 == XdrvMailbox.index) {
return HMC5883L_Command(); // Return true on success
result = HMC5883L_Command(); // Return true on success
}
break;
case FUNC_JSON_APPEND:
@ -247,7 +249,7 @@ bool Xsns101(uint32_t function) {
#endif // USE_WEBSERVER
}
}
return true;
return result;
}
#endif // USE_HMC5883L
#endif // USE_I2C

View File

@ -286,11 +286,18 @@ void QMC5883L_Show(uint8_t json) {
bool Xsns33(uint32_t function) {
if (!I2cEnabled(XI2C_71)) { return false; }
bool result = false;
if (FUNC_INIT == function) {
QMC5883L_Init();
}
else if (QMC5883L != nullptr) {
switch (function) {
// case FUNC_COMMAND_SENSOR:
// if (XSNS_33 == XdrvMailbox.index) {
// result = QMC5883L_CmndSensor();
// }
// break;
case FUNC_JSON_APPEND:
QMC5883L_Show(1);
break;
@ -304,7 +311,7 @@ bool Xsns33(uint32_t function) {
#endif // USE_WEBSERVER
}
}
return true;
return result;
}
#endif // USE_QMC5883L
#endif // USE_I2C