mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 17:52:35 +00:00
Skip setting up Lora GPIO lines when using a ch341 radio on native (#8506)
This commit is contained in:
@@ -393,12 +393,18 @@ void portduinoSetup()
|
|||||||
// Need to bind all the configured GPIO pins so they're not simulated
|
// Need to bind all the configured GPIO pins so they're not simulated
|
||||||
// TODO: If one of these fails, we should log and terminate
|
// TODO: If one of these fails, we should log and terminate
|
||||||
for (auto i : portduino_config.all_pins) {
|
for (auto i : portduino_config.all_pins) {
|
||||||
if (i->enabled)
|
// In the case of a ch341 Lora device, we don't want to touch the system GPIO lines for Lora
|
||||||
|
// Those GPIO are handled in our usermode driver instead.
|
||||||
|
if (i->config_section == "Lora" && portduino_config.lora_spi_dev == "ch341") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (i->enabled) {
|
||||||
if (initGPIOPin(i->pin, gpioChipName + std::to_string(i->gpiochip), i->line) != ERRNO_OK) {
|
if (initGPIOPin(i->pin, gpioChipName + std::to_string(i->gpiochip), i->line) != ERRNO_OK) {
|
||||||
printf("Error setting pin number %d. It may not exist, or may already be in use.\n", i->line);
|
printf("Error setting pin number %d. It may not exist, or may already be in use.\n", i->line);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Only initialize the radio pins when dealing with real, kernel controlled SPI hardware
|
// Only initialize the radio pins when dealing with real, kernel controlled SPI hardware
|
||||||
if (portduino_config.lora_spi_dev != "" && portduino_config.lora_spi_dev != "ch341") {
|
if (portduino_config.lora_spi_dev != "" && portduino_config.lora_spi_dev != "ch341") {
|
||||||
@@ -423,8 +429,7 @@ int initGPIOPin(int pinNum, const std::string gpioChipName, int line)
|
|||||||
{
|
{
|
||||||
#ifdef PORTDUINO_LINUX_HARDWARE
|
#ifdef PORTDUINO_LINUX_HARDWARE
|
||||||
std::string gpio_name = "GPIO" + std::to_string(pinNum);
|
std::string gpio_name = "GPIO" + std::to_string(pinNum);
|
||||||
std::cout << gpio_name;
|
std::cout << "Initializing " << gpio_name << " on chip " << gpioChipName << std::endl;
|
||||||
printf("\n");
|
|
||||||
try {
|
try {
|
||||||
GPIOPin *csPin;
|
GPIOPin *csPin;
|
||||||
csPin = new LinuxGPIOPin(pinNum, gpioChipName.c_str(), line, gpio_name.c_str());
|
csPin = new LinuxGPIOPin(pinNum, gpioChipName.c_str(), line, gpio_name.c_str());
|
||||||
|
|||||||
Reference in New Issue
Block a user