I2C device manager (#2282)

* message on dev list change

* dc detect

* added sht3x sensor.

* separete environment data from light

* max17055 moved to i2c dev

* sht fix, goterror detection fix

* fix ext sensor app display for a lot of devices.

* added bh1750 driver

* autoscan on main view

* added devlist mutex

* better timing

* fix h2 sw8 on poweron by usb
This commit is contained in:
Totoo 2024-10-06 22:14:27 +02:00 committed by GitHub
parent d4edb5f5f9
commit 83b65ba6ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 1459 additions and 472 deletions

View file

@ -939,7 +939,7 @@ static void cmd_gotorientation(BaseSequentialStream* chp, int argc, char* argv[]
}
static void cmd_gotenv(BaseSequentialStream* chp, int argc, char* argv[]) {
const char* usage = "usage: gotenv <temperature> [humidity] [pressure] [light]\r\n";
const char* usage = "usage: gotenv <temperature> [humidity] [pressure] [light]\r\n"; // keeping light here too for compatibility
if (argc < 1 || argc > 4) {
chprintf(chp, usage);
return;
@ -950,8 +950,25 @@ static void cmd_gotenv(BaseSequentialStream* chp, int argc, char* argv[]) {
uint16_t light = 0;
if (argc > 1) humi = atof(argv[1]);
if (argc > 2) pressure = atof(argv[2]);
if (argc > 3) light = strtol(argv[3], NULL, 10);
EnvironmentDataMessage msg{temp, humi, pressure, light};
if (argc > 3) light = strtol(argv[0], NULL, 10);
EnvironmentDataMessage msg{temp, humi, pressure};
EventDispatcher::send_message(msg);
// compatibility:
if (argc > 3) {
LightDataMessage msg{light};
EventDispatcher::send_message(msg);
}
chprintf(chp, "ok\r\n");
}
static void cmd_gotlight(BaseSequentialStream* chp, int argc, char* argv[]) {
const char* usage = "usage: gotlight <light_lux>\r\n";
if (argc != 1) {
chprintf(chp, usage);
return;
}
uint16_t light = strtol(argv[0], NULL, 10);
LightDataMessage msg{light};
EventDispatcher::send_message(msg);
chprintf(chp, "ok\r\n");
}
@ -1191,6 +1208,7 @@ static const ShellCommand commands[] = {
{"gotgps", cmd_gotgps},
{"gotorientation", cmd_gotorientation},
{"gotenv", cmd_gotenv},
{"gotlight", cmd_gotlight},
{"sysinfo", cmd_sysinfo},
{"radioinfo", cmd_radioinfo},
{"pmemreset", cmd_pmemreset},