mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-21 01:04:01 +00:00
Compare commits
2 Commits
f4cff33450
...
fa1a1fd869
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fa1a1fd869 | ||
![]() |
2fd5a4848a |
@ -1,16 +0,0 @@
|
||||
---
|
||||
Lora:
|
||||
## Ebyte E22-900M30S, E22-900M22S with no external RF switching setup
|
||||
## Will work with any module without RF switching, and with TCXO
|
||||
Module: sx1262
|
||||
gpiochip: 1 # subtract 32 from the gpio numbers
|
||||
DIO2_AS_RF_SWITCH: true
|
||||
DIO3_TCXO_VOLTAGE: true
|
||||
CS: 16 #pin6 / GPIO48 1C0
|
||||
IRQ: 23 #pin17 / GPIO55 1C7
|
||||
Busy: 22 #pin16 / GPIO54 1C6
|
||||
Reset: 25 #pin13 / GPIO57 1D1
|
||||
RXen: 24 #pin12 / GPIO56 1D0
|
||||
#TXen: bridge to DIO2 on E22 module
|
||||
spidev: spidev0.0
|
||||
spiSpeed: 2000000
|
@ -1,16 +0,0 @@
|
||||
---
|
||||
Lora:
|
||||
## Ebyte E22-900MM22S with no external RF switching setup
|
||||
## Will work with any module without RF switching and no TCXO
|
||||
Module: sx1262
|
||||
gpiochip: 1 # subtract 32 from the gpio numbers
|
||||
DIO2_AS_RF_SWITCH: true
|
||||
DIO3_TCXO_VOLTAGE: true
|
||||
CS: 16 #pin6 / GPIO48 1C0
|
||||
IRQ: 23 #pin17 / GPIO55 1C7
|
||||
Busy: 22 #pin16 / GPIO54 1C6
|
||||
Reset: 25 #pin13 / GPIO57 1D1
|
||||
RXen: 24 #pin12 / GPIO56 1D0
|
||||
#TXen: bridge to DIO2 on E22 module
|
||||
spidev: spidev0.0
|
||||
spiSpeed: 2000000
|
@ -1,14 +0,0 @@
|
||||
---
|
||||
Lora:
|
||||
## Heltec HT-RA62, Seeed WIO SX1262
|
||||
## Will work with any module with automatic RF switching, and with TCXO
|
||||
Module: sx1262
|
||||
gpiochip: 1 # subtract 32 from the gpio numbers
|
||||
DIO2_AS_RF_SWITCH: true
|
||||
DIO3_TCXO_VOLTAGE: true
|
||||
CS: 16 #pin6 (GPIO pin 48 1C0)
|
||||
IRQ: 23 #pin17 (GPIO pin 55 1C7)
|
||||
Reset: 25 #pin13 (GPIO pin 57 1D1)
|
||||
Busy: 22 #pin16 (GPIO pin 54 1C6)
|
||||
spidev: spidev0.0 #pins are (CS=6, CLK=7, MOSI=8, MISO=9)
|
||||
spiSpeed: 2000000
|
20
bin/config.d/femtofox/femtofox_LR1121_TCXO.yaml
Normal file
20
bin/config.d/femtofox/femtofox_LR1121_TCXO.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
Lora:
|
||||
## Ebyte E80-900M22S
|
||||
## This is a bit experimental
|
||||
##
|
||||
##
|
||||
Module: lr1121
|
||||
gpiochip: 1 # subtract 32 from the gpio numbers
|
||||
DIO3_TCXO_VOLTAGE: 1.8
|
||||
CS: 16 #pin6 / GPIO48 1C0
|
||||
IRQ: 23 #pin17 / GPIO55 1C7
|
||||
Busy: 22 #pin16 / GPIO54 1C6
|
||||
Reset: 25 #pin13 / GPIO57 1D1
|
||||
|
||||
|
||||
spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19)
|
||||
spiSpeed: 2000000
|
||||
|
||||
General:
|
||||
MACAddressSource: eth0
|
21
bin/config.d/femtofox/femtofox_SX1262_TCXO.yaml
Normal file
21
bin/config.d/femtofox/femtofox_SX1262_TCXO.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
Lora:
|
||||
## Ebyte E22-900M30S, E22-900M22S with or without external RF switching setup
|
||||
## HT-RA62 (Has internal switching, but whatever)
|
||||
## Seeed WIO SX1262 (already has TXEN-DIO2 link, but needs RXEN)
|
||||
## Will work with any module with or without RF switching, and with TCXO
|
||||
Module: sx1262
|
||||
gpiochip: 1 # subtract 32 from the gpio numbers
|
||||
DIO2_AS_RF_SWITCH: true
|
||||
DIO3_TCXO_VOLTAGE: true
|
||||
CS: 16 #pin6 / GPIO48 1C0
|
||||
IRQ: 23 #pin17 / GPIO55 1C7
|
||||
Busy: 22 #pin16 / GPIO54 1C6
|
||||
Reset: 25 #pin13 / GPIO57 1D1
|
||||
RXen: 24 #pin12 / GPIO56 1D0 # Not strictly needed for auto-switching, but why complicate things?
|
||||
# TXen: bridge to DIO2 on E22 module
|
||||
spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19)
|
||||
spiSpeed: 2000000
|
||||
|
||||
General:
|
||||
MACAddressSource: eth0
|
21
bin/config.d/femtofox/femtofox_SX1262_XTAL.yaml
Normal file
21
bin/config.d/femtofox/femtofox_SX1262_XTAL.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
Lora:
|
||||
## Ebyte E22-900MM22S with no external RF switching setup
|
||||
## Waveshare SX126X XXXM, AI Thinker RA-01SH
|
||||
## Will work with any module with or without RF switching and no TCXO
|
||||
|
||||
Module: sx1262
|
||||
gpiochip: 1 # subtract 32 from the gpio numbers
|
||||
DIO2_AS_RF_SWITCH: true
|
||||
DIO3_TCXO_VOLTAGE: false
|
||||
CS: 16 #pin6 / GPIO48 1C0
|
||||
IRQ: 23 #pin17 / GPIO55 1C7
|
||||
Busy: 22 #pin16 / GPIO54 1C6
|
||||
Reset: 25 #pin13 / GPIO57 1D1
|
||||
RXen: 24 #pin12 / GPIO56 1D0 # Not strictly needed for auto-switching, but why complicate things?
|
||||
# TXen: bridge to DIO2 on E22 module
|
||||
spidev: spidev0.0 #pins are (CS=16, CLK=17, MOSI=18, MISO=19)
|
||||
spiSpeed: 2000000
|
||||
|
||||
General:
|
||||
MACAddressSource: eth0
|
@ -1,13 +0,0 @@
|
||||
---
|
||||
Lora:
|
||||
## Waveshare SX126X XXXM, AI Thinker RA-01SH
|
||||
## Will work with any module with automatic RF switching, and with no TCXO
|
||||
Module: sx1262
|
||||
gpiochip: 1 # subtract 32 from the gpio numbers
|
||||
DIO2_AS_RF_SWITCH: true
|
||||
CS: 16 #pin6 (GPIO pin 48 1C0)
|
||||
IRQ: 23 #pin17 (GPIO pin 55 1C7)
|
||||
Reset: 25 #pin13 (GPIO pin 57 1D1)
|
||||
Busy: 22 #pin16 (GPIO pin 54 1C6)
|
||||
spidev: spidev0.0 #pins are (CS=6, CLK=7, MOSI=8, MISO=9)
|
||||
spiSpeed: 2000000
|
@ -231,6 +231,23 @@ bool isPrivateIpAddress(const IPAddress &ip)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Separate a <host>[:<port>] string. Returns a pair containing the parsed host and port. If the port is
|
||||
// not present in the input string, or is invalid, the value of the `port` argument will be returned.
|
||||
std::pair<String, uint16_t> parseHostAndPort(String server, uint16_t port = 0)
|
||||
{
|
||||
const int delimIndex = server.indexOf(':');
|
||||
if (delimIndex > 0) {
|
||||
const long parsedPort = server.substring(delimIndex + 1, server.length()).toInt();
|
||||
if (parsedPort < 1 || parsedPort > UINT16_MAX) {
|
||||
LOG_WARN("Invalid MQTT port %d: %s", parsedPort, server.c_str());
|
||||
} else {
|
||||
port = parsedPort;
|
||||
}
|
||||
server[delimIndex] = 0;
|
||||
}
|
||||
return std::make_pair(std::move(server), port);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void MQTT::mqttCallback(char *topic, byte *payload, unsigned int length)
|
||||
@ -308,7 +325,8 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), mqttQueue(MAX_MQTT_QUEUE)
|
||||
}
|
||||
|
||||
IPAddress ip;
|
||||
isMqttServerAddressPrivate = ip.fromString(moduleConfig.mqtt.address) && isPrivateIpAddress(ip);
|
||||
isMqttServerAddressPrivate =
|
||||
ip.fromString(parseHostAndPort(moduleConfig.mqtt.address).first.c_str()) && isPrivateIpAddress(ip);
|
||||
|
||||
#if HAS_NETWORKING
|
||||
if (!moduleConfig.mqtt.proxy_to_client_enabled)
|
||||
@ -424,14 +442,9 @@ void MQTT::reconnect()
|
||||
pubSub.setClient(mqttClient);
|
||||
#endif
|
||||
|
||||
String server = String(serverAddr);
|
||||
int delimIndex = server.indexOf(':');
|
||||
if (delimIndex > 0) {
|
||||
String port = server.substring(delimIndex + 1, server.length());
|
||||
server[delimIndex] = 0;
|
||||
serverPort = port.toInt();
|
||||
serverAddr = server.c_str();
|
||||
}
|
||||
std::pair<String, uint16_t> hostAndPort = parseHostAndPort(serverAddr, serverPort);
|
||||
serverAddr = hostAndPort.first.c_str();
|
||||
serverPort = hostAndPort.second;
|
||||
pubSub.setServer(serverAddr, serverPort);
|
||||
pubSub.setBufferSize(512);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user