mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-30 14:40:40 +00:00
Compare commits
11 Commits
v2.4.3.efc
...
2.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98cb3edff1 | ||
|
|
91d661246a | ||
|
|
a8999d7759 | ||
|
|
1bbc273ba6 | ||
|
|
e37acae405 | ||
|
|
5ff1078c8c | ||
|
|
a577dd4142 | ||
|
|
e0b4a8e31e | ||
|
|
0ebdc7ab0c | ||
|
|
85176756ec | ||
|
|
d398419aef |
@@ -145,6 +145,7 @@ Input:
|
|||||||
Logging:
|
Logging:
|
||||||
LogLevel: info # debug, info, warn, error
|
LogLevel: info # debug, info, warn, error
|
||||||
# TraceFile: /var/log/meshtasticd.json
|
# TraceFile: /var/log/meshtasticd.json
|
||||||
|
# AsciiLogs: true # default if not specified is !isatty() on stdout
|
||||||
|
|
||||||
Webserver:
|
Webserver:
|
||||||
# Port: 443 # Port for Webserver & Webservices
|
# Port: 443 # Port for Webserver & Webservices
|
||||||
@@ -152,4 +153,4 @@ Webserver:
|
|||||||
|
|
||||||
General:
|
General:
|
||||||
MaxNodes: 200
|
MaxNodes: 200
|
||||||
MaxMessageQueue: 100
|
MaxMessageQueue: 100
|
||||||
|
|||||||
@@ -224,7 +224,6 @@ int32_t ButtonThread::runOnce()
|
|||||||
btnEvent = BUTTON_EVENT_NONE;
|
btnEvent = BUTTON_EVENT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
runASAP = false;
|
|
||||||
return 50;
|
return 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ SOFTWARE.*/
|
|||||||
|
|
||||||
#include "DebugConfiguration.h"
|
#include "DebugConfiguration.h"
|
||||||
|
|
||||||
|
#ifdef ARCH_PORTDUINO
|
||||||
|
#include "platform/portduino/PortduinoGlue.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/// A C wrapper for LOG_DEBUG that can be used from arduino C libs that don't know about C++ or meshtastic
|
/// A C wrapper for LOG_DEBUG that can be used from arduino C libs that don't know about C++ or meshtastic
|
||||||
extern "C" void logLegacy(const char *level, const char *fmt, ...)
|
extern "C" void logLegacy(const char *level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
@@ -139,6 +143,11 @@ bool Syslog::vlogf(uint16_t pri, const char *appName, const char *fmt, va_list a
|
|||||||
inline bool Syslog::_sendLog(uint16_t pri, const char *appName, const char *message)
|
inline bool Syslog::_sendLog(uint16_t pri, const char *appName, const char *message)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
#ifdef ARCH_PORTDUINO
|
||||||
|
bool utf = !settingsMap[ascii_logs];
|
||||||
|
#else
|
||||||
|
bool utf = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!this->_enabled)
|
if (!this->_enabled)
|
||||||
return false;
|
return false;
|
||||||
@@ -169,7 +178,12 @@ inline bool Syslog::_sendLog(uint16_t pri, const char *appName, const char *mess
|
|||||||
this->_client->print(this->_deviceHostname);
|
this->_client->print(this->_deviceHostname);
|
||||||
this->_client->print(' ');
|
this->_client->print(' ');
|
||||||
this->_client->print(appName);
|
this->_client->print(appName);
|
||||||
this->_client->print(F(" - - - \xEF\xBB\xBF"));
|
this->_client->print(F(" - - - "));
|
||||||
|
if (utf) {
|
||||||
|
this->_client->print(F("\xEF\xBB\xBF"));
|
||||||
|
} else {
|
||||||
|
this->_client->print(F(" "));
|
||||||
|
}
|
||||||
this->_client->print(F("["));
|
this->_client->print(F("["));
|
||||||
this->_client->print(int(millis() / 1000));
|
this->_client->print(int(millis() / 1000));
|
||||||
this->_client->print(F("]: "));
|
this->_client->print(F("]: "));
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ size_t RedirectablePrint::vprintf(const char *logLevel, const char *format, va_l
|
|||||||
static char printBuf[160];
|
static char printBuf[160];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARCH_PORTDUINO
|
||||||
|
bool color = !settingsMap[ascii_logs];
|
||||||
|
#else
|
||||||
|
bool color = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
va_copy(copy, arg);
|
va_copy(copy, arg);
|
||||||
size_t len = vsnprintf(printBuf, sizeof(printBuf), format, copy);
|
size_t len = vsnprintf(printBuf, sizeof(printBuf), format, copy);
|
||||||
va_end(copy);
|
va_end(copy);
|
||||||
@@ -70,7 +76,7 @@ size_t RedirectablePrint::vprintf(const char *logLevel, const char *format, va_l
|
|||||||
if (!std::isprint(static_cast<unsigned char>(printBuf[f])) && printBuf[f] != '\n')
|
if (!std::isprint(static_cast<unsigned char>(printBuf[f])) && printBuf[f] != '\n')
|
||||||
printBuf[f] = '#';
|
printBuf[f] = '#';
|
||||||
}
|
}
|
||||||
if (logLevel != nullptr) {
|
if (color && logLevel != nullptr) {
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
||||||
Print::write("\u001b[34m", 6);
|
Print::write("\u001b[34m", 6);
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
||||||
@@ -81,7 +87,9 @@ size_t RedirectablePrint::vprintf(const char *logLevel, const char *format, va_l
|
|||||||
Print::write("\u001b[31m", 6);
|
Print::write("\u001b[31m", 6);
|
||||||
}
|
}
|
||||||
len = Print::write(printBuf, len);
|
len = Print::write(printBuf, len);
|
||||||
Print::write("\u001b[0m", 5);
|
if (color && logLevel != nullptr) {
|
||||||
|
Print::write("\u001b[0m", 5);
|
||||||
|
}
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,19 +99,27 @@ void RedirectablePrint::log_to_serial(const char *logLevel, const char *format,
|
|||||||
|
|
||||||
// Cope with 0 len format strings, but look for new line terminator
|
// Cope with 0 len format strings, but look for new line terminator
|
||||||
bool hasNewline = *format && format[strlen(format) - 1] == '\n';
|
bool hasNewline = *format && format[strlen(format) - 1] == '\n';
|
||||||
|
#ifdef ARCH_PORTDUINO
|
||||||
|
bool color = !settingsMap[ascii_logs];
|
||||||
|
#else
|
||||||
|
bool color = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// If we are the first message on a report, include the header
|
// If we are the first message on a report, include the header
|
||||||
if (!isContinuationMessage) {
|
if (!isContinuationMessage) {
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
if (color) {
|
||||||
Print::write("\u001b[34m", 6);
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_DEBUG) == 0)
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
Print::write("\u001b[34m", 6);
|
||||||
Print::write("\u001b[32m", 6);
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_INFO) == 0)
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0)
|
Print::write("\u001b[32m", 6);
|
||||||
Print::write("\u001b[33m", 6);
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_WARN) == 0)
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0)
|
Print::write("\u001b[33m", 6);
|
||||||
Print::write("\u001b[31m", 6);
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_ERROR) == 0)
|
||||||
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
|
Print::write("\u001b[31m", 6);
|
||||||
Print::write("\u001b[35m", 6);
|
if (strcmp(logLevel, MESHTASTIC_LOG_LEVEL_TRACE) == 0)
|
||||||
|
Print::write("\u001b[35m", 6);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // display local time on logfile
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice, true); // display local time on logfile
|
||||||
if (rtc_sec > 0) {
|
if (rtc_sec > 0) {
|
||||||
long hms = rtc_sec % SEC_PER_DAY;
|
long hms = rtc_sec % SEC_PER_DAY;
|
||||||
@@ -117,17 +133,33 @@ void RedirectablePrint::log_to_serial(const char *logLevel, const char *format,
|
|||||||
int min = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
int min = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||||
int sec = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN
|
int sec = (hms % SEC_PER_HOUR) % SEC_PER_MIN; // or hms % SEC_PER_MIN
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
::printf("%s \u001b[0m| %02d:%02d:%02d %u ", logLevel, hour, min, sec, millis() / 1000);
|
::printf("%s ", logLevel);
|
||||||
|
if (color) {
|
||||||
|
::printf("\u001b[0m");
|
||||||
|
}
|
||||||
|
::printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
||||||
#else
|
#else
|
||||||
printf("%s \u001b[0m| %02d:%02d:%02d %u ", logLevel, hour, min, sec, millis() / 1000);
|
printf("%s ", logLevel);
|
||||||
|
if (color) {
|
||||||
|
printf("\u001b[0m");
|
||||||
|
}
|
||||||
|
printf("| %02d:%02d:%02d %u ", hour, min, sec, millis() / 1000);
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else {
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
::printf("%s \u001b[0m| ??:??:?? %u ", logLevel, millis() / 1000);
|
::printf("%s ", logLevel);
|
||||||
|
if (color) {
|
||||||
|
::printf("\u001b[0m");
|
||||||
|
}
|
||||||
|
::printf("| ??:??:?? %u ", millis() / 1000);
|
||||||
#else
|
#else
|
||||||
printf("%s \u001b[0m| ??:??:?? %u ", logLevel, millis() / 1000);
|
printf("%s ", logLevel);
|
||||||
|
if (color) {
|
||||||
|
printf("\u001b[0m");
|
||||||
|
}
|
||||||
|
printf("| ??:??:?? %u ", millis() / 1000);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
auto thread = concurrency::OSThread::currentThread;
|
auto thread = concurrency::OSThread::currentThread;
|
||||||
if (thread) {
|
if (thread) {
|
||||||
print("[");
|
print("[");
|
||||||
@@ -350,4 +382,4 @@ std::string RedirectablePrint::mt_sprintf(const std::string fmt_str, ...)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return std::string(formatted.get());
|
return std::string(formatted.get());
|
||||||
}
|
}
|
||||||
|
|||||||
260
src/input/ExpressLRSFiveWay.cpp
Normal file
260
src/input/ExpressLRSFiveWay.cpp
Normal file
@@ -0,0 +1,260 @@
|
|||||||
|
|
||||||
|
#include "ExpressLRSFiveWay.h"
|
||||||
|
|
||||||
|
#ifdef INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE
|
||||||
|
|
||||||
|
static const char inputSourceName[] = "ExpressLRS5Way"; // should match "allow input source" string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Calculate fuzz: half the distance to the next nearest neighbor for each joystick position.
|
||||||
|
*
|
||||||
|
* The goal is to avoid collisions between joystick positions while still maintaining
|
||||||
|
* the widest tolerance for the analog value.
|
||||||
|
*
|
||||||
|
* Example: {10,50,800,1000,300,1600}
|
||||||
|
* If we just choose the minimum difference for this array the value would
|
||||||
|
* be 40/2 = 20.
|
||||||
|
*
|
||||||
|
* 20 does not leave enough room for the joystick position using 1600 which
|
||||||
|
* could have a +-100 offset.
|
||||||
|
*
|
||||||
|
* Example Fuzz values: {20, 20, 100, 100, 125, 300} now the fuzz for the 1600
|
||||||
|
* position is 300 instead of 20
|
||||||
|
*/
|
||||||
|
void ExpressLRSFiveWay::calcFuzzValues()
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < N_JOY_ADC_VALUES; i++) {
|
||||||
|
uint16_t closestDist = 0xffff;
|
||||||
|
uint16_t ival = joyAdcValues[i];
|
||||||
|
// Find the closest value to ival
|
||||||
|
for (unsigned int j = 0; j < N_JOY_ADC_VALUES; j++) {
|
||||||
|
// Don't compare value with itself
|
||||||
|
if (j == i)
|
||||||
|
continue;
|
||||||
|
uint16_t jval = joyAdcValues[j];
|
||||||
|
if (jval < ival && (ival - jval < closestDist))
|
||||||
|
closestDist = ival - jval;
|
||||||
|
if (jval > ival && (jval - ival < closestDist))
|
||||||
|
closestDist = jval - ival;
|
||||||
|
} // for j
|
||||||
|
|
||||||
|
// And the fuzz is half the distance to the closest value
|
||||||
|
fuzzValues[i] = closestDist / 2;
|
||||||
|
// DBG("joy%u=%u f=%u, ", i, ival, fuzzValues[i]);
|
||||||
|
} // for i
|
||||||
|
}
|
||||||
|
|
||||||
|
int ExpressLRSFiveWay::readKey()
|
||||||
|
{
|
||||||
|
uint16_t value = analogRead(PIN_JOYSTICK);
|
||||||
|
|
||||||
|
constexpr uint8_t IDX_TO_INPUT[N_JOY_ADC_VALUES - 1] = {UP, DOWN, LEFT, RIGHT, OK};
|
||||||
|
for (unsigned int i = 0; i < N_JOY_ADC_VALUES - 1; ++i) {
|
||||||
|
if (value < (joyAdcValues[i] + fuzzValues[i]) && value > (joyAdcValues[i] - fuzzValues[i]))
|
||||||
|
return IDX_TO_INPUT[i];
|
||||||
|
}
|
||||||
|
return NO_PRESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
ExpressLRSFiveWay::ExpressLRSFiveWay() : concurrency::OSThread(inputSourceName)
|
||||||
|
{
|
||||||
|
// ExpressLRS: init values
|
||||||
|
isLongPressed = false;
|
||||||
|
keyInProcess = NO_PRESS;
|
||||||
|
keyDownStart = 0;
|
||||||
|
|
||||||
|
// Express LRS: calculate the threshold for interpreting ADC values as various buttons
|
||||||
|
calcFuzzValues();
|
||||||
|
|
||||||
|
// Meshtastic: register with canned messages
|
||||||
|
inputBroker->registerSource(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExpressLRS: interpret reading as key events
|
||||||
|
void ExpressLRSFiveWay::update(int *keyValue, bool *keyLongPressed)
|
||||||
|
{
|
||||||
|
*keyValue = NO_PRESS;
|
||||||
|
|
||||||
|
int newKey = readKey();
|
||||||
|
uint32_t now = millis();
|
||||||
|
if (keyInProcess == NO_PRESS) {
|
||||||
|
// New key down
|
||||||
|
if (newKey != NO_PRESS) {
|
||||||
|
keyDownStart = now;
|
||||||
|
// DBGLN("down=%u", newKey);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if key released
|
||||||
|
if (newKey == NO_PRESS) {
|
||||||
|
// DBGLN("up=%u", keyInProcess);
|
||||||
|
if (!isLongPressed) {
|
||||||
|
if ((now - keyDownStart) > KEY_DEBOUNCE_MS) {
|
||||||
|
*keyValue = keyInProcess;
|
||||||
|
*keyLongPressed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isLongPressed = false;
|
||||||
|
}
|
||||||
|
// else if the key has changed while down, reset state for next go-around
|
||||||
|
else if (newKey != keyInProcess) {
|
||||||
|
newKey = NO_PRESS;
|
||||||
|
}
|
||||||
|
// else still pressing, waiting for long if not already signaled
|
||||||
|
else if (!isLongPressed) {
|
||||||
|
if ((now - keyDownStart) > KEY_LONG_PRESS_MS) {
|
||||||
|
*keyValue = keyInProcess;
|
||||||
|
*keyLongPressed = true;
|
||||||
|
isLongPressed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // if keyInProcess != NO_PRESS
|
||||||
|
|
||||||
|
keyInProcess = newKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Meshtastic: runs at regular intervals
|
||||||
|
int32_t ExpressLRSFiveWay::runOnce()
|
||||||
|
{
|
||||||
|
uint32_t now = millis();
|
||||||
|
|
||||||
|
// Dismiss any alert frames after 2 seconds
|
||||||
|
// Feedback for GPS toggle / adhoc ping
|
||||||
|
if (alerting && now > alertingSinceMs + 2000) {
|
||||||
|
alerting = false;
|
||||||
|
screen->endAlert();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get key events from ExpressLRS code
|
||||||
|
int keyValue;
|
||||||
|
bool longPressed;
|
||||||
|
update(&keyValue, &longPressed);
|
||||||
|
|
||||||
|
// Do something about this key press
|
||||||
|
determineAction((KeyType)keyValue, longPressed ? LONG : SHORT);
|
||||||
|
|
||||||
|
// If there has been recent key activity, poll the joystick slightly more frequently
|
||||||
|
if (now < keyDownStart + (20 * 1000UL)) // Within last 20 seconds
|
||||||
|
return 100;
|
||||||
|
|
||||||
|
// Otherwise, poll slightly less often
|
||||||
|
// Too many missed pressed if much slower than 250ms
|
||||||
|
return 250;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine what action to take when a button press is detected
|
||||||
|
// Written verbose for easier remapping by user
|
||||||
|
void ExpressLRSFiveWay::determineAction(KeyType key, PressLength length)
|
||||||
|
{
|
||||||
|
switch (key) {
|
||||||
|
case LEFT:
|
||||||
|
if (inCannedMessageMenu()) // If in canned message menu
|
||||||
|
sendKey(CANCEL); // exit the menu (press imaginary cancel key)
|
||||||
|
else
|
||||||
|
sendKey(LEFT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RIGHT:
|
||||||
|
if (inCannedMessageMenu()) // If in canned message menu:
|
||||||
|
sendKey(CANCEL); // exit the menu (press imaginary cancel key)
|
||||||
|
else
|
||||||
|
sendKey(RIGHT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UP:
|
||||||
|
if (length == LONG)
|
||||||
|
toggleGPS();
|
||||||
|
else
|
||||||
|
sendKey(UP);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DOWN:
|
||||||
|
if (length == LONG)
|
||||||
|
sendAdhocPing();
|
||||||
|
else
|
||||||
|
sendKey(DOWN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OK:
|
||||||
|
if (length == LONG)
|
||||||
|
shutdown();
|
||||||
|
else
|
||||||
|
click(); // Use instead of sendKey(OK). Works better when canned message module disabled
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Feed input to the canned messages module
|
||||||
|
void ExpressLRSFiveWay::sendKey(KeyType key)
|
||||||
|
{
|
||||||
|
InputEvent e;
|
||||||
|
e.source = inputSourceName;
|
||||||
|
e.inputEvent = key;
|
||||||
|
notifyObservers(&e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable or Disable a connected GPS
|
||||||
|
// Contained as one method for easier remapping of buttons by user
|
||||||
|
void ExpressLRSFiveWay::toggleGPS()
|
||||||
|
{
|
||||||
|
#if HAS_GPS && !MESHTASTIC_EXCLUDE_GPS
|
||||||
|
if (!config.device.disable_triple_click && (gps != nullptr)) {
|
||||||
|
gps->toggleGpsMode();
|
||||||
|
screen->startAlert("GPS Toggled");
|
||||||
|
alerting = true;
|
||||||
|
alertingSinceMs = millis();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send either node-info or position, on demand
|
||||||
|
// Contained as one method for easier remapping of buttons by user
|
||||||
|
void ExpressLRSFiveWay::sendAdhocPing()
|
||||||
|
{
|
||||||
|
service->refreshLocalMeshNode();
|
||||||
|
bool sentPosition = service->trySendPosition(NODENUM_BROADCAST, true);
|
||||||
|
|
||||||
|
// Show custom alert frame, with multi-line centering
|
||||||
|
screen->startAlert([sentPosition](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void {
|
||||||
|
uint16_t x_offset = display->width() / 2;
|
||||||
|
uint16_t y_offset = 26; // Same constant as the default startAlert frame
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
|
display->setFont(FONT_MEDIUM);
|
||||||
|
display->drawString(x_offset + x, y_offset + y, "Sent ad-hoc");
|
||||||
|
display->drawString(x_offset + x, y_offset + FONT_HEIGHT_MEDIUM + y, sentPosition ? "position" : "nodeinfo");
|
||||||
|
});
|
||||||
|
|
||||||
|
alerting = true;
|
||||||
|
alertingSinceMs = millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shutdown the node (enter deep-sleep)
|
||||||
|
// Contained as one method for easier remapping of buttons by user
|
||||||
|
void ExpressLRSFiveWay::shutdown()
|
||||||
|
{
|
||||||
|
LOG_INFO("Shutdown from long press\n");
|
||||||
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
|
screen->startAlert("Shutting down...");
|
||||||
|
// Don't set alerting = true. We don't want to auto-dismiss this alert.
|
||||||
|
|
||||||
|
playShutdownMelody(); // In case user adds a buzzer
|
||||||
|
|
||||||
|
shutdownAtMsec = millis() + 3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emulate user button, or canned message SELECT
|
||||||
|
// This is necessary as canned message module doesn't translate SELECT to user button presses if the module is disabled
|
||||||
|
// Contained as one method for easier remapping of buttons by user
|
||||||
|
void ExpressLRSFiveWay::click()
|
||||||
|
{
|
||||||
|
if (!moduleConfig.canned_message.enabled)
|
||||||
|
powerFSM.trigger(EVENT_PRESS);
|
||||||
|
else
|
||||||
|
sendKey(OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
ExpressLRSFiveWay *expressLRSFiveWayInput = nullptr;
|
||||||
|
|
||||||
|
#endif
|
||||||
85
src/input/ExpressLRSFiveWay.h
Normal file
85
src/input/ExpressLRSFiveWay.h
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
Input source for Radio Master Bandit Nano, and similar hardware.
|
||||||
|
Devices have a 5-button "resistor ladder" style joystick, read by ADC.
|
||||||
|
These devices do not use the ADC to monitor input voltage.
|
||||||
|
|
||||||
|
Much of this code taken directly from ExpressLRS FiveWayButton class:
|
||||||
|
https://github.com/ExpressLRS/ExpressLRS/tree/d9f56f8bd6f9f7144d5f01caaca766383e1e0950/src/lib/SCREEN/FiveWayButton
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
#ifdef INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE
|
||||||
|
|
||||||
|
#include <esp_adc_cal.h>
|
||||||
|
#include <soc/adc_channel.h>
|
||||||
|
|
||||||
|
#include "InputBroker.h"
|
||||||
|
#include "MeshService.h" // For adhoc ping action
|
||||||
|
#include "buzz.h"
|
||||||
|
#include "concurrency/OSThread.h"
|
||||||
|
#include "graphics/Screen.h" // Feedback for adhoc ping / toggle GPS
|
||||||
|
#include "main.h"
|
||||||
|
#include "modules/CannedMessageModule.h"
|
||||||
|
|
||||||
|
#if HAS_GPS && !MESHTASTIC_EXCLUDE_GPS
|
||||||
|
#include "GPS.h" // For toggle GPS action
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class ExpressLRSFiveWay : public Observable<const InputEvent *>, public concurrency::OSThread
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
// Number of values in JOY_ADC_VALUES, if defined
|
||||||
|
// These must be ADC readings for {UP, DOWN, LEFT, RIGHT, ENTER, IDLE}
|
||||||
|
static constexpr size_t N_JOY_ADC_VALUES = 6;
|
||||||
|
static constexpr uint32_t KEY_DEBOUNCE_MS = 25;
|
||||||
|
static constexpr uint32_t KEY_LONG_PRESS_MS = 3000; // How many milliseconds to hold key for a long press
|
||||||
|
|
||||||
|
// This merged an enum used by the ExpressLRS code, with meshtastic canned message values
|
||||||
|
// Key names are kept simple, to allow user customizaton
|
||||||
|
typedef enum {
|
||||||
|
UP = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP,
|
||||||
|
DOWN = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN,
|
||||||
|
LEFT = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT,
|
||||||
|
RIGHT = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT,
|
||||||
|
OK = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT,
|
||||||
|
CANCEL = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL,
|
||||||
|
NO_PRESS = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE
|
||||||
|
} KeyType;
|
||||||
|
|
||||||
|
typedef enum { SHORT, LONG } PressLength;
|
||||||
|
|
||||||
|
// From ExpressLRS
|
||||||
|
int keyInProcess;
|
||||||
|
uint32_t keyDownStart;
|
||||||
|
bool isLongPressed;
|
||||||
|
const uint16_t joyAdcValues[N_JOY_ADC_VALUES] = {JOYSTICK_ADC_VALS};
|
||||||
|
uint16_t fuzzValues[N_JOY_ADC_VALUES];
|
||||||
|
void calcFuzzValues();
|
||||||
|
int readKey();
|
||||||
|
void update(int *keyValue, bool *keyLongPressed);
|
||||||
|
|
||||||
|
// Meshtastic code
|
||||||
|
void determineAction(KeyType key, PressLength length);
|
||||||
|
void sendKey(KeyType key);
|
||||||
|
inline bool inCannedMessageMenu() { return cannedMessageModule->shouldDraw(); }
|
||||||
|
int32_t runOnce() override;
|
||||||
|
|
||||||
|
// Simplified Meshtastic actions, for easier remapping by user
|
||||||
|
void toggleGPS();
|
||||||
|
void sendAdhocPing();
|
||||||
|
void shutdown();
|
||||||
|
void click();
|
||||||
|
|
||||||
|
bool alerting = false; // Is the screen showing an alert frame? Feedback for GPS toggle / adhoc ping actions
|
||||||
|
uint32_t alertingSinceMs = 0; // When did screen begin showing an alert frame? Used to auto-dismiss
|
||||||
|
|
||||||
|
public:
|
||||||
|
ExpressLRSFiveWay();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern ExpressLRSFiveWay *expressLRSFiveWayInput;
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -13,7 +13,9 @@
|
|||||||
#define default_min_wake_secs 10
|
#define default_min_wake_secs 10
|
||||||
#define default_screen_on_secs IF_ROUTER(1, 60 * 10)
|
#define default_screen_on_secs IF_ROUTER(1, 60 * 10)
|
||||||
#define default_node_info_broadcast_secs 3 * 60 * 60
|
#define default_node_info_broadcast_secs 3 * 60 * 60
|
||||||
|
#define default_neighbor_info_broadcast_secs 6 * 60 * 60
|
||||||
#define min_node_info_broadcast_secs 60 * 60 // No regular broadcasts of more than once an hour
|
#define min_node_info_broadcast_secs 60 * 60 // No regular broadcasts of more than once an hour
|
||||||
|
#define min_neighbor_info_broadcast_secs 2 * 60 * 60
|
||||||
|
|
||||||
#define default_mqtt_address "mqtt.meshtastic.org"
|
#define default_mqtt_address "mqtt.meshtastic.org"
|
||||||
#define default_mqtt_username "meshdev"
|
#define default_mqtt_username "meshdev"
|
||||||
|
|||||||
@@ -557,6 +557,10 @@ void AdminModule::handleSetModuleConfig(const meshtastic_ModuleConfig &c)
|
|||||||
case meshtastic_ModuleConfig_neighbor_info_tag:
|
case meshtastic_ModuleConfig_neighbor_info_tag:
|
||||||
LOG_INFO("Setting module config: Neighbor Info\n");
|
LOG_INFO("Setting module config: Neighbor Info\n");
|
||||||
moduleConfig.has_neighbor_info = true;
|
moduleConfig.has_neighbor_info = true;
|
||||||
|
if (moduleConfig.neighbor_info.update_interval < min_neighbor_info_broadcast_secs) {
|
||||||
|
LOG_DEBUG("Tried to set update_interval too low, setting to %d\n", default_neighbor_info_broadcast_secs);
|
||||||
|
moduleConfig.neighbor_info.update_interval = default_neighbor_info_broadcast_secs;
|
||||||
|
}
|
||||||
moduleConfig.neighbor_info = c.payload_variant.neighbor_info;
|
moduleConfig.neighbor_info = c.payload_variant.neighbor_info;
|
||||||
break;
|
break;
|
||||||
case meshtastic_ModuleConfig_detection_sensor_tag:
|
case meshtastic_ModuleConfig_detection_sensor_tag:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#if !MESHTASTIC_EXCLUDE_INPUTBROKER
|
#if !MESHTASTIC_EXCLUDE_INPUTBROKER
|
||||||
|
#include "input/ExpressLRSFiveWay.h"
|
||||||
#include "input/InputBroker.h"
|
#include "input/InputBroker.h"
|
||||||
#include "input/RotaryEncoderInterruptImpl1.h"
|
#include "input/RotaryEncoderInterruptImpl1.h"
|
||||||
#include "input/ScanAndSelect.h"
|
#include "input/ScanAndSelect.h"
|
||||||
@@ -176,6 +177,9 @@ void setupModules()
|
|||||||
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
trackballInterruptImpl1 = new TrackballInterruptImpl1();
|
||||||
trackballInterruptImpl1->init();
|
trackballInterruptImpl1->init();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE
|
||||||
|
expressLRSFiveWayInput = new ExpressLRSFiveWay();
|
||||||
|
#endif
|
||||||
#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
|
#if HAS_SCREEN && !MESHTASTIC_EXCLUDE_CANNEDMESSAGES
|
||||||
cannedMessageModule = new CannedMessageModule();
|
cannedMessageModule = new CannedMessageModule();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -120,8 +120,7 @@ int32_t NeighborInfoModule::runOnce()
|
|||||||
if (airTime->isTxAllowedChannelUtil(true) && airTime->isTxAllowedAirUtil()) {
|
if (airTime->isTxAllowedChannelUtil(true) && airTime->isTxAllowedAirUtil()) {
|
||||||
sendNeighborInfo(NODENUM_BROADCAST, false);
|
sendNeighborInfo(NODENUM_BROADCAST, false);
|
||||||
}
|
}
|
||||||
return Default::getConfiguredOrDefaultMsScaled(moduleConfig.neighbor_info.update_interval, default_broadcast_interval_secs,
|
return Default::getConfiguredOrDefaultMs(moduleConfig.neighbor_info.update_interval, default_neighbor_info_broadcast_secs);
|
||||||
numOnlineNodes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -140,7 +140,8 @@ void PositionModule::trySetRtc(meshtastic_Position p, bool isLocal, bool forceUp
|
|||||||
|
|
||||||
bool PositionModule::hasQualityTimesource()
|
bool PositionModule::hasQualityTimesource()
|
||||||
{
|
{
|
||||||
bool setFromPhoneOrNtpToday = (millis() - lastSetFromPhoneNtpOrGps) <= (SEC_PER_DAY * 1000UL);
|
bool setFromPhoneOrNtpToday =
|
||||||
|
lastSetFromPhoneNtpOrGps == 0 ? false : (millis() - lastSetFromPhoneNtpOrGps) <= (SEC_PER_DAY * 1000UL);
|
||||||
bool hasGpsOrRtc = (gps && gps->isConnected()) || (rtc_found.address != ScanI2C::ADDRESS_NONE.address);
|
bool hasGpsOrRtc = (gps && gps->isConnected()) || (rtc_found.address != ScanI2C::ADDRESS_NONE.address);
|
||||||
return hasGpsOrRtc || setFromPhoneOrNtpToday;
|
return hasGpsOrRtc || setFromPhoneOrNtpToday;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,14 @@
|
|||||||
int32_t DeviceTelemetryModule::runOnce()
|
int32_t DeviceTelemetryModule::runOnce()
|
||||||
{
|
{
|
||||||
refreshUptime();
|
refreshUptime();
|
||||||
|
bool isImpoliteRole = config.device.role == meshtastic_Config_DeviceConfig_Role_SENSOR ||
|
||||||
|
config.device.role == meshtastic_Config_DeviceConfig_Role_ROUTER;
|
||||||
if (((lastSentToMesh == 0) ||
|
if (((lastSentToMesh == 0) ||
|
||||||
((uptimeLastMs - lastSentToMesh) >=
|
((uptimeLastMs - lastSentToMesh) >=
|
||||||
Default::getConfiguredOrDefaultMsScaled(moduleConfig.telemetry.device_update_interval,
|
Default::getConfiguredOrDefaultMsScaled(moduleConfig.telemetry.device_update_interval,
|
||||||
default_telemetry_broadcast_interval_secs, numOnlineNodes))) &&
|
default_telemetry_broadcast_interval_secs, numOnlineNodes))) &&
|
||||||
airTime->isTxAllowedChannelUtil(config.device.role != meshtastic_Config_DeviceConfig_Role_SENSOR) &&
|
airTime->isTxAllowedChannelUtil(!isImpoliteRole) && airTime->isTxAllowedAirUtil() &&
|
||||||
airTime->isTxAllowedAirUtil() && config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER &&
|
config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER &&
|
||||||
config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_HIDDEN) {
|
config.device.role != meshtastic_Config_DeviceConfig_Role_CLIENT_HIDDEN) {
|
||||||
sendTelemetry();
|
sendTelemetry();
|
||||||
lastSentToMesh = uptimeLastMs;
|
lastSentToMesh = uptimeLastMs;
|
||||||
|
|||||||
@@ -62,6 +62,8 @@
|
|||||||
#define HW_VENDOR meshtastic_HardwareModel_WIO_WM1110
|
#define HW_VENDOR meshtastic_HardwareModel_WIO_WM1110
|
||||||
#elif defined(TRACKER_T1000_E)
|
#elif defined(TRACKER_T1000_E)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_TRACKER_T1000_E
|
#define HW_VENDOR meshtastic_HardwareModel_TRACKER_T1000_E
|
||||||
|
#elif defined(ME25LS01)
|
||||||
|
#define HW_VENDOR meshtastic_HardwareModel_ME25LS01
|
||||||
#elif defined(PRIVATE_HW) || defined(FEATHER_DIY)
|
#elif defined(PRIVATE_HW) || defined(FEATHER_DIY)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW
|
#define HW_VENDOR meshtastic_HardwareModel_PRIVATE_HW
|
||||||
#else
|
#else
|
||||||
@@ -116,4 +118,4 @@
|
|||||||
#if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA)
|
#if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA)
|
||||||
// No serial ports on this board - ONLY use segger in memory console
|
// No serial ports on this board - ONLY use segger in memory console
|
||||||
#define USE_SEGGER
|
#define USE_SEGGER
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ void portduinoSetup()
|
|||||||
settingsStrings[spidev] = "";
|
settingsStrings[spidev] = "";
|
||||||
settingsStrings[displayspidev] = "";
|
settingsStrings[displayspidev] = "";
|
||||||
settingsMap[spiSpeed] = 2000000;
|
settingsMap[spiSpeed] = 2000000;
|
||||||
|
settingsMap[ascii_logs] = !isatty(1);
|
||||||
|
|
||||||
YAML::Node yamlConfig;
|
YAML::Node yamlConfig;
|
||||||
|
|
||||||
@@ -152,6 +153,10 @@ void portduinoSetup()
|
|||||||
settingsMap[logoutputlevel] = level_error;
|
settingsMap[logoutputlevel] = level_error;
|
||||||
}
|
}
|
||||||
settingsStrings[traceFilename] = yamlConfig["Logging"]["TraceFile"].as<std::string>("");
|
settingsStrings[traceFilename] = yamlConfig["Logging"]["TraceFile"].as<std::string>("");
|
||||||
|
if (yamlConfig["Logging"]["AsciiLogs"]) {
|
||||||
|
// Default is !isatty(1) but can be set explicitly in config.yaml
|
||||||
|
settingsMap[ascii_logs] = yamlConfig["Logging"]["AsciiLogs"].as<bool>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (yamlConfig["Lora"]) {
|
if (yamlConfig["Lora"]) {
|
||||||
settingsMap[use_sx1262] = false;
|
settingsMap[use_sx1262] = false;
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ enum configNames {
|
|||||||
webserverport,
|
webserverport,
|
||||||
webserverrootpath,
|
webserverrootpath,
|
||||||
maxtophone,
|
maxtophone,
|
||||||
maxnodes
|
maxnodes,
|
||||||
|
ascii_logs
|
||||||
};
|
};
|
||||||
enum { no_screen, x11, st7789, st7735, st7735s, st7796, ili9341, ili9488, hx8357d };
|
enum { no_screen, x11, st7789, st7735, st7735s, st7796, ili9341, ili9488, hx8357d };
|
||||||
enum { no_touchscreen, xpt2046, stmpe610, gt911, ft5x06 };
|
enum { no_touchscreen, xpt2046, stmpe610, gt911, ft5x06 };
|
||||||
@@ -62,4 +63,4 @@ enum { level_error, level_warn, level_info, level_debug, level_trace };
|
|||||||
extern std::map<configNames, int> settingsMap;
|
extern std::map<configNames, int> settingsMap;
|
||||||
extern std::map<configNames, std::string> settingsStrings;
|
extern std::map<configNames, std::string> settingsStrings;
|
||||||
extern std::ofstream traceFile;
|
extern std::ofstream traceFile;
|
||||||
int initGPIOPin(int pinNum, std::string gpioChipname);
|
int initGPIOPin(int pinNum, std::string gpioChipname);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ extern "C" {
|
|||||||
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
||||||
|
|
||||||
// Buzzer
|
// Buzzer
|
||||||
#define BUZZER_EN_PIN -1
|
#define PIN_BUZZER (0 + 25)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
@@ -136,4 +136,4 @@ extern "C" {
|
|||||||
* Arduino objects - C++ only
|
* Arduino objects - C++ only
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#endif // _VARIANT_ME25LS01_4Y10TD_
|
#endif // _VARIANT_ME25LS01_4Y10TD_
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
||||||
|
|
||||||
// Buzzer
|
// Buzzer
|
||||||
#define BUZZER_EN_PIN -1
|
#define PIN_BUZZER (0 + 25)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
@@ -159,4 +159,4 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
* Arduino objects - C++ only
|
* Arduino objects - C++ only
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#endif // _VARIANT_ME25LS01_4Y10TD__
|
#endif // _VARIANT_ME25LS01_4Y10TD__
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
#define SENSOR_POWER_CTRL_PIN 21
|
#define SENSOR_POWER_CTRL_PIN 21
|
||||||
#define SENSOR_POWER_ON 1
|
#define SENSOR_POWER_ON 1
|
||||||
|
|
||||||
|
#define PERIPHERAL_WARMUP_MS 100
|
||||||
#define SENSOR_GPS_CONFLICT
|
#define SENSOR_GPS_CONFLICT
|
||||||
|
|
||||||
#define ESP32S3_WAKE_TYPE ESP_EXT1_WAKEUP_ANY_HIGH
|
#define ESP32S3_WAKE_TYPE ESP_EXT1_WAKEUP_ANY_HIGH
|
||||||
@@ -41,14 +41,11 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Five way button when using ADC.
|
Five way button when using ADC.
|
||||||
2.632V, 2.177V, 1.598V, 1.055V, 0V
|
https://github.com/ExpressLRS/targets/blob/f3215b5ec891108db1a13523e4163950cfcadaac/TX/Radiomaster%20Bandit.json#L41
|
||||||
|
|
||||||
Possible ADC Values:
|
|
||||||
{ UP, DOWN, LEFT, RIGHT, ENTER, IDLE }
|
|
||||||
3227, 0 ,1961, 2668, 1290, 4095
|
|
||||||
*/
|
*/
|
||||||
#define BUTTON_PIN 39
|
#define INPUTBROKER_EXPRESSLRSFIVEWAY_TYPE
|
||||||
#define BUTTON_NEED_PULLUP
|
#define PIN_JOYSTICK 39
|
||||||
|
#define JOYSTICK_ADC_VALS /*UP*/ 3227, /*DOWN*/ 0, /*LEFT*/ 1961, /*RIGHT*/ 2668, /*OK*/ 1290, /*IDLE*/ 4095
|
||||||
|
|
||||||
#define DISPLAY_FLIP_SCREEN
|
#define DISPLAY_FLIP_SCREEN
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
// rxd = 9
|
// rxd = 9
|
||||||
|
|
||||||
#define EXT_NOTIFY_OUT 22
|
#define EXT_NOTIFY_OUT 22
|
||||||
#define BUTTON_PIN 17
|
#undef BUTTON_PIN // Pin 17 used for antenna switching via DIO4
|
||||||
|
|
||||||
#define LED_PIN PIN_LED
|
#define LED_PIN PIN_LED
|
||||||
|
|
||||||
@@ -32,23 +32,28 @@
|
|||||||
|
|
||||||
// https://www.waveshare.com/rp2040-lora.htm
|
// https://www.waveshare.com/rp2040-lora.htm
|
||||||
// https://www.waveshare.com/img/devkit/RP2040-LoRa-HF/RP2040-LoRa-HF-details-11.jpg
|
// https://www.waveshare.com/img/devkit/RP2040-LoRa-HF/RP2040-LoRa-HF-details-11.jpg
|
||||||
#define LORA_SCK 14 // 10
|
#define LORA_SCK 14 // GPIO14
|
||||||
#define LORA_MISO 24 // 12
|
#define LORA_MISO 24 // GPIO24
|
||||||
#define LORA_MOSI 15 // 11
|
#define LORA_MOSI 15 // GPIO15
|
||||||
#define LORA_CS 13 // 3
|
#define LORA_CS 13 // GPIO13
|
||||||
|
|
||||||
#define LORA_DIO0 RADIOLIB_NC
|
#define LORA_DIO0 RADIOLIB_NC // No GPIO connection
|
||||||
#define LORA_RESET 23 // 15
|
#define LORA_RESET 23 // GPIO23
|
||||||
#define LORA_DIO1 16 // 20
|
#define LORA_BUSY 18 // GPIO18
|
||||||
#define LORA_DIO2 18 // 2
|
#define LORA_DIO1 16 // GPIO16
|
||||||
#define LORA_DIO3 RADIOLIB_NC
|
#define LORA_DIO2 RADIOLIB_NC // Antenna switching, no GPIO connection
|
||||||
#define LORA_DIO4 17
|
#define LORA_DIO3 RADIOLIB_NC // No GPIO connection
|
||||||
|
#define LORA_DIO4 17 // GPIO17
|
||||||
|
|
||||||
|
// On rp2040-lora board the antenna switch is wired and works with complementary-pin control logic.
|
||||||
|
// See PE4259 datasheet page 4
|
||||||
|
|
||||||
#ifdef USE_SX1262
|
#ifdef USE_SX1262
|
||||||
#define SX126X_CS LORA_CS
|
#define SX126X_CS LORA_CS
|
||||||
#define SX126X_DIO1 LORA_DIO1
|
#define SX126X_DIO1 LORA_DIO1
|
||||||
#define SX126X_BUSY LORA_DIO2
|
#define SX126X_BUSY LORA_BUSY
|
||||||
#define SX126X_RESET LORA_RESET
|
#define SX126X_RESET LORA_RESET
|
||||||
#define SX126X_DIO2_AS_RF_SWITCH
|
#define SX126X_DIO2_AS_RF_SWITCH // Antenna switch CTRL
|
||||||
|
#define SX126X_RXEN LORA_DIO4 // Antenna switch !CTRL via GPIO17
|
||||||
// #define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
// #define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||||
#endif
|
#endif
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 2
|
major = 2
|
||||||
minor = 4
|
minor = 4
|
||||||
build = 3
|
build = 4
|
||||||
|
|||||||
Reference in New Issue
Block a user