Skip to content

Commit

Permalink
1PMG3 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Dec 7, 2024
1 parent ebad23b commit b9754f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ShellyPlus1PM/shelly_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ void CreatePeripherals(std::vector<std::unique_ptr<Input>> *inputs,
LOG(LL_ERROR, ("PM init failed: %s", s.c_str()));
}
#else
//init for BL0942 on Gen3 here TODO
// init for BL0942 on Gen3 here TODO
#endif
sys_temp->reset(new TempSensorSDNT1608X103F3950(ADC_GPIO, 3.3f, 10000.0f));

int pin_out = ADDON_OUT_GPIO;
int pin_in = ADDON:IN_GPIO;
int pin_in = ADDON_IN_GPIO;

if (DetectAddon(pin_in, pin_out)) {
s_onewire.reset(new Onewire(pin_in, pin_out));
Expand Down
3 changes: 3 additions & 0 deletions src/shelly_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ void RestoreUART() {
}

bool DetectAddon(int pin_in, int pin_out) {
if (pin_in == -1 || pin_out == -1) {
return false;
}
// case 1: input with pull up
mgos_gpio_setup_input(pin_in, MGOS_GPIO_PULL_UP);
// check if pulled by something external, not check output to input yet
Expand Down

0 comments on commit b9754f8

Please sign in to comment.