mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
Portduino: Allow limiting TX Power from yaml (#5954)
This commit is contained in:
parent
6a12760c3d
commit
78da8f6fc4
@ -78,6 +78,8 @@ Lora:
|
|||||||
# TXen: x # TX and RX enable pins
|
# TXen: x # TX and RX enable pins
|
||||||
# RXen: x
|
# RXen: x
|
||||||
|
|
||||||
|
# SX126X_MAX_POWER: 8 # Limit the output power to 8 dBm, useful for amped nodes
|
||||||
|
|
||||||
# spiSpeed: 2000000
|
# spiSpeed: 2000000
|
||||||
|
|
||||||
### Set default/fallback gpio chip to use in /dev/. Defaults to 0.
|
### Set default/fallback gpio chip to use in /dev/. Defaults to 0.
|
||||||
@ -188,4 +190,4 @@ General:
|
|||||||
MaxMessageQueue: 100
|
MaxMessageQueue: 100
|
||||||
ConfigDirectory: /etc/meshtasticd/config.d/
|
ConfigDirectory: /etc/meshtasticd/config.d/
|
||||||
# MACAddress: AA:BB:CC:DD:EE:FF
|
# MACAddress: AA:BB:CC:DD:EE:FF
|
||||||
# MACAddressSource: eth0
|
# MACAddressSource: eth0
|
@ -7,3 +7,6 @@ Lora:
|
|||||||
TXen: 13
|
TXen: 13
|
||||||
RXen: 12
|
RXen: 12
|
||||||
DIO3_TCXO_VOLTAGE: true
|
DIO3_TCXO_VOLTAGE: true
|
||||||
|
# Only for E22-900M33S:
|
||||||
|
# Limit the output power to 8 dBm
|
||||||
|
# SX126X_MAX_POWER: 8
|
@ -20,12 +20,18 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
|
|
||||||
// Particular boards might define a different max power based on what their hardware can do, default to max power output if not
|
// Particular boards might define a different max power based on what their hardware can do, default to max power output if not
|
||||||
// specified (may be dangerous if using external PA and LR11x0 power config forgotten)
|
// specified (may be dangerous if using external PA and LR11x0 power config forgotten)
|
||||||
|
#if ARCH_PORTDUINO
|
||||||
|
#define LR1110_MAX_POWER settingsMap[lr1110_max_power]
|
||||||
|
#endif
|
||||||
#ifndef LR1110_MAX_POWER
|
#ifndef LR1110_MAX_POWER
|
||||||
#define LR1110_MAX_POWER 22
|
#define LR1110_MAX_POWER 22
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// the 2.4G part maxes at 13dBm
|
// the 2.4G part maxes at 13dBm
|
||||||
|
|
||||||
|
#if ARCH_PORTDUINO
|
||||||
|
#define LR1120_MAX_POWER settingsMap[lr1120_max_power]
|
||||||
|
#endif
|
||||||
#ifndef LR1120_MAX_POWER
|
#ifndef LR1120_MAX_POWER
|
||||||
#define LR1120_MAX_POWER 13
|
#define LR1120_MAX_POWER 13
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
#include "PortduinoGlue.h"
|
#include "PortduinoGlue.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ARCH_PORTDUINO
|
||||||
|
#define RF95_MAX_POWER settingsMap[rf95_max_power]
|
||||||
|
#endif
|
||||||
#ifndef RF95_MAX_POWER
|
#ifndef RF95_MAX_POWER
|
||||||
#define RF95_MAX_POWER 20
|
#define RF95_MAX_POWER 20
|
||||||
#endif
|
#endif
|
||||||
@ -337,4 +340,4 @@ bool RF95Interface::sleep()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -11,6 +11,9 @@
|
|||||||
|
|
||||||
// Particular boards might define a different max power based on what their hardware can do, default to max power output if not
|
// Particular boards might define a different max power based on what their hardware can do, default to max power output if not
|
||||||
// specified (may be dangerous if using external PA and SX126x power config forgotten)
|
// specified (may be dangerous if using external PA and SX126x power config forgotten)
|
||||||
|
#if ARCH_PORTDUINO
|
||||||
|
#define SX126X_MAX_POWER settingsMap[sx126x_max_power]
|
||||||
|
#endif
|
||||||
#ifndef SX126X_MAX_POWER
|
#ifndef SX126X_MAX_POWER
|
||||||
#define SX126X_MAX_POWER 22
|
#define SX126X_MAX_POWER 22
|
||||||
#endif
|
#endif
|
||||||
@ -333,4 +336,4 @@ template <typename T> bool SX126xInterface<T>::sleep()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -10,6 +10,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Particular boards might define a different max power based on what their hardware can do
|
// Particular boards might define a different max power based on what their hardware can do
|
||||||
|
#if ARCH_PORTDUINO
|
||||||
|
#define SX128X_MAX_POWER settingsMap[sx128x_max_power]
|
||||||
|
#endif
|
||||||
#ifndef SX128X_MAX_POWER
|
#ifndef SX128X_MAX_POWER
|
||||||
#define SX128X_MAX_POWER 13
|
#define SX128X_MAX_POWER 13
|
||||||
#endif
|
#endif
|
||||||
@ -315,4 +318,4 @@ template <typename T> bool SX128xInterface<T>::sleep()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -369,6 +369,12 @@ bool loadConfig(const char *configPath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
settingsMap[sx126x_max_power] = yamlConfig["Lora"]["SX126X_MAX_POWER"].as<int>(22);
|
||||||
|
settingsMap[sx128x_max_power] = yamlConfig["Lora"]["SX128X_MAX_POWER"].as<int>(13);
|
||||||
|
settingsMap[lr1110_max_power] = yamlConfig["Lora"]["LR1110_MAX_POWER"].as<int>(22);
|
||||||
|
settingsMap[lr1120_max_power] = yamlConfig["Lora"]["LR1120_MAX_POWER"].as<int>(13);
|
||||||
|
settingsMap[rf95_max_power] = yamlConfig["Lora"]["RF95_MAX_POWER"].as<int>(20);
|
||||||
|
|
||||||
settingsMap[dio2_as_rf_switch] = yamlConfig["Lora"]["DIO2_AS_RF_SWITCH"].as<bool>(false);
|
settingsMap[dio2_as_rf_switch] = yamlConfig["Lora"]["DIO2_AS_RF_SWITCH"].as<bool>(false);
|
||||||
settingsMap[dio3_tcxo_voltage] = yamlConfig["Lora"]["DIO3_TCXO_VOLTAGE"].as<float>(0) * 1000;
|
settingsMap[dio3_tcxo_voltage] = yamlConfig["Lora"]["DIO3_TCXO_VOLTAGE"].as<float>(0) * 1000;
|
||||||
if (settingsMap[dio3_tcxo_voltage] == 0 && yamlConfig["Lora"]["DIO3_TCXO_VOLTAGE"].as<bool>(false)) {
|
if (settingsMap[dio3_tcxo_voltage] == 0 && yamlConfig["Lora"]["DIO3_TCXO_VOLTAGE"].as<bool>(false)) {
|
||||||
@ -569,4 +575,4 @@ bool MAC_from_string(std::string mac_str, uint8_t *dmac)
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,6 +27,11 @@ enum configNames {
|
|||||||
sx126x_ant_sw_pin,
|
sx126x_ant_sw_pin,
|
||||||
sx126x_ant_sw_line,
|
sx126x_ant_sw_line,
|
||||||
sx126x_ant_sw_gpiochip,
|
sx126x_ant_sw_gpiochip,
|
||||||
|
sx126x_max_power,
|
||||||
|
sx128x_max_power,
|
||||||
|
lr1110_max_power,
|
||||||
|
lr1120_max_power,
|
||||||
|
rf95_max_power,
|
||||||
dio2_as_rf_switch,
|
dio2_as_rf_switch,
|
||||||
dio3_tcxo_voltage,
|
dio3_tcxo_voltage,
|
||||||
use_rf95,
|
use_rf95,
|
||||||
@ -94,4 +99,4 @@ int initGPIOPin(int pinNum, std::string gpioChipname, int line);
|
|||||||
bool loadConfig(const char *configPath);
|
bool loadConfig(const char *configPath);
|
||||||
static bool ends_with(std::string_view str, std::string_view suffix);
|
static bool ends_with(std::string_view str, std::string_view suffix);
|
||||||
void getMacAddr(uint8_t *dmac);
|
void getMacAddr(uint8_t *dmac);
|
||||||
bool MAC_from_string(std::string mac_str, uint8_t *dmac);
|
bool MAC_from_string(std::string mac_str, uint8_t *dmac);
|
Loading…
Reference in New Issue
Block a user