mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-14 07:21:30 +10:00
Add GPIO_DETECT_PA portduino config, and support 13302 detection with it (#9741)
* Add GPIO_DETECT_PA portduino config, and support 13302 detection with it. * Tweak PA detect gpio to use pinMapping * minor yaml output fixes --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
co-authored by
Ben Meadors
parent
a93d4d7e9d
commit
5a068431ed
@@ -537,6 +537,27 @@ void portduinoSetup()
|
||||
}
|
||||
}
|
||||
|
||||
// In one test, this dance seemed necessary to trigger the pin to detect properly.
|
||||
if (portduino_config.lora_pa_detect_pin.enabled) {
|
||||
pinMode(portduino_config.lora_pa_detect_pin.pin, INPUT_PULLDOWN);
|
||||
sleep(1);
|
||||
if (digitalRead(portduino_config.lora_pa_detect_pin.pin) == LOW) {
|
||||
std::cout << "Pin " << portduino_config.lora_pa_detect_pin.pin << " PULLDOWN is LOW" << std::endl;
|
||||
}
|
||||
pinMode(portduino_config.lora_pa_detect_pin.pin, INPUT_PULLUP);
|
||||
sleep(1);
|
||||
if (digitalRead(portduino_config.lora_pa_detect_pin.pin) == HIGH) {
|
||||
std::cout << "Pin " << portduino_config.lora_pa_detect_pin.pin << " PULLUP is HIGH, dropping PA curve" << std::endl;
|
||||
portduino_config.num_pa_points = 1;
|
||||
portduino_config.tx_gain_lora[0] = 0;
|
||||
} else {
|
||||
std::cout << "Pin " << portduino_config.lora_pa_detect_pin.pin << " PULLUP is LOW, using PA curve" << std::endl;
|
||||
}
|
||||
|
||||
// disable bias once finished
|
||||
pinMode(portduino_config.lora_pa_detect_pin.pin, INPUT);
|
||||
}
|
||||
|
||||
// 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") {
|
||||
SPI.begin(portduino_config.lora_spi_dev.c_str());
|
||||
|
||||
Reference in New Issue
Block a user