mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-27 00:35:59 -04:00
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:
parent
d4edb5f5f9
commit
83b65ba6ce
35 changed files with 1459 additions and 472 deletions
|
@ -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},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue