Merge pull request #3895 from meshtastic/fix-guards

fix native compilation for linux PCs
This commit is contained in:
Thomas Göttgens 2024-05-15 12:25:21 +02:00 committed by GitHub
commit 7810e59b0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,6 @@
; The Portduino based sim environment on top of any host OS, all hardware will be simulated
[portduino_base]
platform = https://github.com/meshtastic/platform-native.git#9881bf3721d610cccacf5ae8e3a07839cce75d63
platform = https://github.com/meshtastic/platform-native.git#f5ec3c031b0fcd89c0523de9e43eef3a92d59292
framework = arduino
build_src_filter =

View File

@ -283,7 +283,7 @@ void portduinoSetup()
}
for (configNames i : GPIO_lines) {
if (settingsMap[i] > max_GPIO)
if (settingsMap.count(i) && settingsMap[i] > max_GPIO)
max_GPIO = settingsMap[i];
}
@ -342,6 +342,7 @@ void portduinoSetup()
if (settingsMap[touchscreenIRQ] > 0)
initGPIOPin(settingsMap[touchscreenIRQ], gpioChipName);
}
if (settingsStrings[spidev] != "") {
SPI.begin(settingsStrings[spidev].c_str());
}
@ -350,6 +351,7 @@ void portduinoSetup()
int initGPIOPin(int pinNum, const std::string gpioChipName)
{
#ifdef PORTDUINO_LINUX_HARDWARE
std::string gpio_name = "GPIO" + std::to_string(pinNum);
try {
GPIOPin *csPin;
@ -362,4 +364,7 @@ int initGPIOPin(int pinNum, const std::string gpioChipName)
std::cout << "Warning, cannot claim pin " << gpio_name << (p ? p.__cxa_exception_type()->name() : "null") << std::endl;
return ERRNO_DISABLED;
}
#else
return ERRNO_OK;
#endif
}