Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 28, 2024
1 parent 27faa27 commit 7c522f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion mos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ conds:
SWITCH2_GPIO: 10
ADC_GPIO: 1
SDA_GPIO: 6
ADDON_OUT_GPIO: 0
ADDON_IN_GPIO: 7
config_schema:
- ["device.id", "Shelly2PMG3-??????"]
- ["shelly.name", "Shelly2PMG3-??????"]
Expand Down Expand Up @@ -1084,7 +1086,7 @@ conds:
cdefs:
LED_GPIO: 0
LED_ON: 0
BTN_GPIO: 4
BTN_GPIO: 27
BTN_DOWN: 0
PRODUCT_HW_REV: "0.1.9"
STOCK_FW_MODEL: Plus2PM
Expand All @@ -1098,6 +1100,8 @@ conds:
SWITCH2_GPIO: 18
ADC_GPIO: 37
SDA_GPIO: 33
ADDON_OUT_GPIO: 0
ADDON_IN_GPIO: 1
config_schema:
- ["device.id", "ShellyPlus2PM-??????"]
- ["shelly.name", "ShellyPlus2PM-??????"]
Expand Down
9 changes: 5 additions & 4 deletions src/ShellyPlus2PM/shelly_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ void CreatePeripherals(std::vector<std::unique_ptr<Input>> *inputs,
int adc_pin = new_rev ? 35 : ADC_GPIO;
sys_temp->reset(new TempSensorSDNT1608X103F3950(adc_pin, 3.3f, 10000.0f));

int pin_out = 0;
int pin_in = 1; // UART Output pin on Plus
int pin_out = ADDON_OUT_GPIO;
int pin_in = ADDON_IN_GPIO; // UART Output pin on Plus

if (DetectAddon(pin_in, pin_out)) {
s_onewire.reset(new Onewire(pin_in, pin_out));
Expand All @@ -174,7 +174,8 @@ void CreatePeripherals(std::vector<std::unique_ptr<Input>> *inputs,
sensors = DiscoverDHTSensors(pin_in, pin_out);
}

auto *in_digital = new InputPin(3, 19, 0, MGOS_GPIO_PULL_NONE, false);
auto *in_digital =
new InputPin(3, ADDON_DIG_GPIO, 0, MGOS_GPIO_PULL_NONE, false);
in_digital->Init();
inputs->emplace_back(in_digital);

Expand All @@ -183,7 +184,7 @@ void CreatePeripherals(std::vector<std::unique_ptr<Input>> *inputs,
InitSysLED(LED_GPIO, LED_ON);
}

InitSysBtn(new_rev ? BTN_GPIO : 27, BTN_DOWN);
InitSysBtn(new_rev ? 4 : BTN_GPIO, BTN_DOWN);
}

void CreateComponents(std::vector<std::unique_ptr<Component>> *comps,
Expand Down

0 comments on commit 7c522f0

Please sign in to comment.