Skip to content

Commit

Permalink
Configure pin modes of selected pins before attempting to write to th…
Browse files Browse the repository at this point in the history
…em (#4385)
  • Loading branch information
Kealper authored Aug 4, 2024
1 parent 5453c49 commit 5bbafdf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/RemoteHardwareModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ bool RemoteHardwareModule::handleReceivedProtobuf(const meshtastic_MeshPacket &r
// Print notification to LCD screen
screen->print("Write GPIOs\n");

pinModes(p.gpio_mask, OUTPUT);
for (uint8_t i = 0; i < NUM_GPIOS; i++) {
uint64_t mask = 1ULL << i;
if (p.gpio_mask & mask) {
digitalWrite(i, (p.gpio_value & mask) ? 1 : 0);
}
}
pinModes(p.gpio_mask, OUTPUT);

break;
}
Expand Down

0 comments on commit 5bbafdf

Please sign in to comment.