Skip to content

Commit

Permalink
remove note for pm1
Browse files Browse the repository at this point in the history
  • Loading branch information
markirb committed Aug 29, 2024
1 parent f0abb85 commit 1218d81
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
43 changes: 22 additions & 21 deletions src/Shelly1PM/shelly_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,29 @@ void CreatePeripherals(std::vector<std::unique_ptr<Input>> *inputs,
}
sys_temp->reset(new TempSensorSDNT1608X103F3950(0, 3.3f, 33000.0f));

// REMOVED FOR TESTING PURPOSES
// int pin_in = 3;
// int pin_out = LED_GPIO;
// Note: this does not work currently, it always detects an addon. most likely
// pin in is always pulled somewhere?
int pin_in = 3;
int pin_out = LED_GPIO;

// if (DetectAddon(pin_in, pin_out)) {
// s_onewire.reset(new Onewire(pin_in, pin_out));
// sensors = s_onewire->DiscoverAll();
// if (sensors.empty()) {
// s_onewire.reset();
// sensors = DiscoverDHTSensors(pin_in, pin_out);
// }
// if (sensors.empty()) {
// // No sensors detected, we assume to use addon as input for switch or
// // closed/open sensor
// auto *in2 = new InputPin(2, pin_in, 0, MGOS_GPIO_PULL_NONE, false);
// in2->Init();
// inputs->emplace_back(in2);
// }
// } else {
// // Sys LED shares the same pin.
// InitSysLED(LED_GPIO, LED_ON);
// }
if (DetectAddon(pin_in, pin_out)) {
s_onewire.reset(new Onewire(pin_in, pin_out));
sensors = s_onewire->DiscoverAll();
if (sensors.empty()) {
s_onewire.reset();
sensors = DiscoverDHTSensors(pin_in, pin_out);
}
if (sensors.empty()) {
// No sensors detected, we assume to use addon as input for switch or
// closed/open sensor
auto *in2 = new InputPin(2, pin_in, 0, MGOS_GPIO_PULL_NONE, false);
in2->Init();
inputs->emplace_back(in2);
}
} else {
// Sys LED shares the same pin.
InitSysLED(LED_GPIO, LED_ON);
}
InitSysBtn(BTN_GPIO, BTN_DOWN);
}

Expand Down
3 changes: 1 addition & 2 deletions src/ShellyRGBW2/shelly_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void CreatePeripherals(std::vector<std::unique_ptr<Input>> *inputs,
in->Init();
inputs->emplace_back(in);

// TODO: add more inputs for +RGBWPM
#ifdef GPIO_I2
in = new InputPin(2, GPIO_I2, 1, MGOS_GPIO_PULL_NONE, true);
in->AddHandler(std::bind(&HandleInputResetSequence, in, 0, _1, _2));
Expand Down Expand Up @@ -118,7 +117,7 @@ void CreateComponents(std::vector<std::unique_ptr<Component>> *comps,
out_pin += 3;
}

Input *in = FindInput(i);
Input *in = FindInput(i + 1);

hap_light.reset(new hap::LightBulb(
i + 1, in, std::move(lightbulb_controller), lb_cfg, is_optional));
Expand Down

0 comments on commit 1218d81

Please sign in to comment.