Track actual GPIO values, not just the enum values (#3768)

* Track actual GPIO values, not just the enum values

* trunk
This commit is contained in:
Jonathan Bennett 2024-05-02 13:39:28 -05:00 committed by GitHub
parent 71400103b3
commit 06e7d2b845
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,7 +75,7 @@ void portduinoSetup()
{ {
printf("Setting up Meshtastic on Portduino...\n"); printf("Setting up Meshtastic on Portduino...\n");
int max_GPIO = 0; int max_GPIO = 0;
int GPIO_lines[] = {cs, configNames GPIO_lines[] = {cs,
irq, irq,
busy, busy,
reset, reset,
@ -281,9 +281,9 @@ void portduinoSetup()
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
for (int i : GPIO_lines) { for (configNames i : GPIO_lines) {
if (i > max_GPIO) if (settingsMap[i] > max_GPIO)
max_GPIO = i; max_GPIO = settingsMap[i];
} }
gpioInit(max_GPIO + 1); // Done here so we can inform Portduino how many GPIOs we need. gpioInit(max_GPIO + 1); // Done here so we can inform Portduino how many GPIOs we need.