Configure pin modes of selected pins before attempting to write to them (#4385)

This commit is contained in:
Ken Piper 2024-08-04 06:06:36 -05:00 committed by GitHub
parent 5453c495e2
commit 5bbafdfd31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}