mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-28 04:31:58 +00:00
Compare commits
3 Commits
develop
...
fix-radio-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44733609c9 | ||
|
|
f0cdb777b2 | ||
|
|
ef8f90f8b1 |
@@ -1,23 +0,0 @@
|
|||||||
Lora:
|
|
||||||
Module: sx1262
|
|
||||||
CS: 0
|
|
||||||
IRQ: 6
|
|
||||||
Reset: 1
|
|
||||||
Busy: 4
|
|
||||||
RXen: 2
|
|
||||||
DIO2_AS_RF_SWITCH: true
|
|
||||||
spidev: ch341
|
|
||||||
USB_PID: 0x5512
|
|
||||||
USB_VID: 0x1A86
|
|
||||||
DIO3_TCXO_VOLTAGE: true
|
|
||||||
# USB_Serialnum: 12345678
|
|
||||||
SX126X_MAX_POWER: 22
|
|
||||||
# Reduce output power to improve EMI
|
|
||||||
NUM_PA_POINTS: 22
|
|
||||||
TX_GAIN_LORA: 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 9, 8, 8, 7
|
|
||||||
# Note: This module integrates an additional PA to achieve higher output power.
|
|
||||||
# The 'power' parameter here does not represent the actual RF output.
|
|
||||||
# TX_GAIN_LORA defines the gain offset applied at each SX1262 input power step (1–22 dBm).
|
|
||||||
# Each array element corresponds to the additional gain when that input level is set,
|
|
||||||
# The effective RF output is: Pout ≈ Pset + TX_GAIN_LORA[index].
|
|
||||||
# Please refer to https://github.com/linser233/uMesh/blob/main/RF_Power.md for detailed information.
|
|
||||||
15
bin/config.d/lora-usb-umesh-1262.yaml
Normal file
15
bin/config.d/lora-usb-umesh-1262.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Lora:
|
||||||
|
Module: sx1262
|
||||||
|
CS: 0
|
||||||
|
IRQ: 6
|
||||||
|
Reset: 1
|
||||||
|
Busy: 4
|
||||||
|
RXen: 2
|
||||||
|
DIO2_AS_RF_SWITCH: true
|
||||||
|
spidev: ch341
|
||||||
|
USB_PID: 0x5512
|
||||||
|
USB_VID: 0x1A86
|
||||||
|
DIO3_TCXO_VOLTAGE: true
|
||||||
|
# USB_Serialnum: 12345678
|
||||||
|
SX126X_MAX_POWER: 30
|
||||||
|
# Reduce output power to improve EMI
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
Lora:
|
|
||||||
Module: sx1268
|
|
||||||
CS: 0
|
|
||||||
IRQ: 6
|
|
||||||
Reset: 1
|
|
||||||
Busy: 4
|
|
||||||
RXen: 2
|
|
||||||
DIO2_AS_RF_SWITCH: true
|
|
||||||
spidev: ch341
|
|
||||||
USB_PID: 0x5512
|
|
||||||
USB_VID: 0x1A86
|
|
||||||
DIO3_TCXO_VOLTAGE: true
|
|
||||||
# USB_Serialnum: 12345678
|
|
||||||
SX126X_MAX_POWER: 22
|
|
||||||
# Reduce output power to improve EMI
|
|
||||||
NUM_PA_POINTS: 22
|
|
||||||
TX_GAIN_LORA: 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 9, 8, 8, 7
|
|
||||||
# Note: This module integrates an additional PA to achieve higher output power.
|
|
||||||
# The 'power' parameter here does not represent the actual RF output.
|
|
||||||
# TX_GAIN_LORA defines the gain offset applied at each SX1262 input power step (1–22 dBm).
|
|
||||||
# Each array element corresponds to the additional gain when that input level is set,
|
|
||||||
# The effective RF output is: Pout ≈ Pset + TX_GAIN_LORA[index].
|
|
||||||
# Please refer to https://github.com/linser233/uMesh/blob/main/RF_Power.md for detailed information.
|
|
||||||
15
bin/config.d/lora-usb-umesh-1268.yaml
Normal file
15
bin/config.d/lora-usb-umesh-1268.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Lora:
|
||||||
|
Module: sx1268
|
||||||
|
CS: 0
|
||||||
|
IRQ: 6
|
||||||
|
Reset: 1
|
||||||
|
Busy: 4
|
||||||
|
RXen: 2
|
||||||
|
DIO2_AS_RF_SWITCH: true
|
||||||
|
spidev: ch341
|
||||||
|
USB_PID: 0x5512
|
||||||
|
USB_VID: 0x1A86
|
||||||
|
DIO3_TCXO_VOLTAGE: true
|
||||||
|
# USB_Serialnum: 12345678
|
||||||
|
SX126X_MAX_POWER: 30
|
||||||
|
# Reduce output power to improve EMI
|
||||||
@@ -119,7 +119,7 @@ lib_deps =
|
|||||||
[device-ui_base]
|
[device-ui_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic/device-ui packageName=https://github.com/meshtastic/device-ui gitBranch=master
|
||||||
https://github.com/meshtastic/device-ui/archive/69739b84f87a91568d3c421498bc89977937a141.zip
|
https://github.com/meshtastic/device-ui/archive/37ad715b76cd6ca4aa500a4a4d9740e3cdf3e3cb.zip
|
||||||
|
|
||||||
; Common libs for environmental measurements in telemetry module
|
; Common libs for environmental measurements in telemetry module
|
||||||
[environmental_base]
|
[environmental_base]
|
||||||
|
|||||||
Submodule protobufs updated: bc63a57f9e...77c8329a59
@@ -1731,26 +1731,6 @@ int Screen::handleInputEvent(const InputEvent *event)
|
|||||||
showFrame(FrameDirection::PREVIOUS);
|
showFrame(FrameDirection::PREVIOUS);
|
||||||
} else if (event->inputEvent == INPUT_BROKER_RIGHT || event->inputEvent == INPUT_BROKER_USER_PRESS) {
|
} else if (event->inputEvent == INPUT_BROKER_RIGHT || event->inputEvent == INPUT_BROKER_USER_PRESS) {
|
||||||
showFrame(FrameDirection::NEXT);
|
showFrame(FrameDirection::NEXT);
|
||||||
} else if (event->inputEvent == INPUT_BROKER_FN_F1) {
|
|
||||||
this->ui->switchToFrame(0);
|
|
||||||
lastScreenTransition = millis();
|
|
||||||
setFastFramerate();
|
|
||||||
} else if (event->inputEvent == INPUT_BROKER_FN_F2) {
|
|
||||||
this->ui->switchToFrame(1);
|
|
||||||
lastScreenTransition = millis();
|
|
||||||
setFastFramerate();
|
|
||||||
} else if (event->inputEvent == INPUT_BROKER_FN_F3) {
|
|
||||||
this->ui->switchToFrame(2);
|
|
||||||
lastScreenTransition = millis();
|
|
||||||
setFastFramerate();
|
|
||||||
} else if (event->inputEvent == INPUT_BROKER_FN_F4) {
|
|
||||||
this->ui->switchToFrame(3);
|
|
||||||
lastScreenTransition = millis();
|
|
||||||
setFastFramerate();
|
|
||||||
} else if (event->inputEvent == INPUT_BROKER_FN_F5) {
|
|
||||||
this->ui->switchToFrame(4);
|
|
||||||
lastScreenTransition = millis();
|
|
||||||
setFastFramerate();
|
|
||||||
} else if (event->inputEvent == INPUT_BROKER_UP_LONG) {
|
} else if (event->inputEvent == INPUT_BROKER_UP_LONG) {
|
||||||
// Long press up button for fast frame switching
|
// Long press up button for fast frame switching
|
||||||
showPrevFrame();
|
showPrevFrame();
|
||||||
|
|||||||
@@ -431,6 +431,45 @@ static int getDrawnLinePixelBottom(int lineTopY, const std::string &line, bool i
|
|||||||
return iconTop + tallest - 1;
|
return iconTop + tallest - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void drawRoundedRectOutline(OLEDDisplay *display, int x, int y, int w, int h, int r)
|
||||||
|
{
|
||||||
|
if (w <= 1 || h <= 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (r < 0)
|
||||||
|
r = 0;
|
||||||
|
|
||||||
|
int maxR = (std::min(w, h) / 2) - 1;
|
||||||
|
if (r > maxR)
|
||||||
|
r = maxR;
|
||||||
|
|
||||||
|
if (r == 0) {
|
||||||
|
display->drawRect(x, y, w, h);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int x0 = x;
|
||||||
|
const int y0 = y;
|
||||||
|
const int x1 = x + w - 1;
|
||||||
|
const int y1 = y + h - 1;
|
||||||
|
|
||||||
|
// sides
|
||||||
|
if (x0 + r <= x1 - r) {
|
||||||
|
display->drawLine(x0 + r, y0, x1 - r, y0); // top
|
||||||
|
display->drawLine(x0 + r, y1, x1 - r, y1); // bottom
|
||||||
|
}
|
||||||
|
if (y0 + r <= y1 - r) {
|
||||||
|
display->drawLine(x0, y0 + r, x0, y1 - r); // left
|
||||||
|
display->drawLine(x1, y0 + r, x1, y1 - r); // right
|
||||||
|
}
|
||||||
|
|
||||||
|
// corner arcs
|
||||||
|
display->drawCircleQuads(x0 + r, y0 + r, r, 2); // top left
|
||||||
|
display->drawCircleQuads(x1 - r, y0 + r, r, 1); // top right
|
||||||
|
display->drawCircleQuads(x1 - r, y1 - r, r, 8); // bottom right
|
||||||
|
display->drawCircleQuads(x0 + r, y1 - r, r, 4); // bottom left
|
||||||
|
}
|
||||||
|
|
||||||
static std::vector<MessageBlock> buildMessageBlocks(const std::vector<bool> &isHeaderVec, const std::vector<bool> &isMineVec)
|
static std::vector<MessageBlock> buildMessageBlocks(const std::vector<bool> &isHeaderVec, const std::vector<bool> &isMineVec)
|
||||||
{
|
{
|
||||||
std::vector<MessageBlock> blocks;
|
std::vector<MessageBlock> blocks;
|
||||||
@@ -870,37 +909,27 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
bubbleW = std::max(1, rightEdge - bubbleX);
|
bubbleW = std::max(1, rightEdge - bubbleX);
|
||||||
|
|
||||||
if (bubbleW > 1 && bubbleH > 1) {
|
if (bubbleW > 1 && bubbleH > 1) {
|
||||||
|
int r = BUBBLE_RADIUS;
|
||||||
|
int maxR = (std::min(bubbleW, bubbleH) / 2) - 1;
|
||||||
|
if (maxR < 0)
|
||||||
|
maxR = 0;
|
||||||
|
if (r > maxR)
|
||||||
|
r = maxR;
|
||||||
|
|
||||||
|
drawRoundedRectOutline(display, bubbleX, topY, bubbleW, bubbleH, r);
|
||||||
|
const int extra = 3;
|
||||||
|
const int rr = r + extra;
|
||||||
int x1 = bubbleX + bubbleW - 1;
|
int x1 = bubbleX + bubbleW - 1;
|
||||||
int y1 = topY + bubbleH - 1;
|
int y1 = topY + bubbleH - 1;
|
||||||
|
|
||||||
if (b.mine) {
|
if (!b.mine) {
|
||||||
// Send Message (Right side)
|
// top-left corner square
|
||||||
display->drawRect(x1 + 2 - bubbleW, y1 - bubbleH, bubbleW, bubbleH);
|
display->drawLine(bubbleX, topY, bubbleX + rr, topY);
|
||||||
// Top Right Corner
|
display->drawLine(bubbleX, topY, bubbleX, topY + rr);
|
||||||
display->drawRect(x1, topY, 2, 1);
|
|
||||||
display->drawRect(x1, topY, 1, 2);
|
|
||||||
// Bottom Right Corner
|
|
||||||
display->drawRect(x1 - 1, bottomY - 2, 2, 1);
|
|
||||||
display->drawRect(x1, bottomY - 3, 1, 2);
|
|
||||||
// Knock the corners off to make a bubble
|
|
||||||
display->setColor(BLACK);
|
|
||||||
display->drawRect(x1 - bubbleW, topY - 1, 1, 1);
|
|
||||||
display->drawRect(x1 - bubbleW, bottomY - 1, 1, 1);
|
|
||||||
display->setColor(WHITE);
|
|
||||||
} else {
|
} else {
|
||||||
// Received Message (Left Side)
|
// bottom-right corner square
|
||||||
display->drawRect(bubbleX, topY, bubbleW + 1, bubbleH);
|
display->drawLine(x1 - rr, y1, x1, y1);
|
||||||
// Top Left Corner
|
display->drawLine(x1, y1 - rr, x1, y1);
|
||||||
display->drawRect(bubbleX + 1, topY + 1, 2, 1);
|
|
||||||
display->drawRect(bubbleX + 1, topY + 1, 1, 2);
|
|
||||||
// Bottom Left Corner
|
|
||||||
display->drawRect(bubbleX + 1, bottomY - 1, 2, 1);
|
|
||||||
display->drawRect(bubbleX + 1, bottomY - 2, 1, 2);
|
|
||||||
// Knock the corners off to make a bubble
|
|
||||||
display->setColor(BLACK);
|
|
||||||
display->drawRect(bubbleX + bubbleW, topY, 1, 1);
|
|
||||||
display->drawRect(bubbleX + bubbleW, bottomY, 1, 1);
|
|
||||||
display->setColor(WHITE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,20 +20,20 @@ constexpr uint8_t modifierLeftShift = 0b0001;
|
|||||||
|
|
||||||
// Num chars per key, Modulus for rotating through characters
|
// Num chars per key, Modulus for rotating through characters
|
||||||
static uint8_t HackadayCommunicatorTapMod[_TCA8418_NUM_KEYS] = {
|
static uint8_t HackadayCommunicatorTapMod[_TCA8418_NUM_KEYS] = {
|
||||||
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 0, 0, 0, 1, 2, 2, 2, 1, 2, 2, 0, 0, 0, 2, 1, 2, 2, 0, 1, 1, 0,
|
0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 0, 0, 0, 1, 2, 2, 2, 1, 2, 2, 0, 0, 0, 2, 1, 2, 2, 0, 1, 1, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned char HackadayCommunicatorTapMap[_TCA8418_NUM_KEYS][2] = {{},
|
static unsigned char HackadayCommunicatorTapMap[_TCA8418_NUM_KEYS][2] = {{},
|
||||||
{Key::FUNCTION_F1},
|
{},
|
||||||
{'+'},
|
{'+'},
|
||||||
{'9'},
|
{'9'},
|
||||||
{'8'},
|
{'8'},
|
||||||
{'7'},
|
{'7'},
|
||||||
{Key::FUNCTION_F2},
|
{'2'},
|
||||||
{Key::FUNCTION_F3},
|
{'3'},
|
||||||
{Key::FUNCTION_F4},
|
{'4'},
|
||||||
{Key::FUNCTION_F5},
|
{'5'},
|
||||||
{Key::ESC},
|
{Key::ESC},
|
||||||
{'q', 'Q'},
|
{'q', 'Q'},
|
||||||
{'w', 'W'},
|
{'w', 'W'},
|
||||||
@@ -141,7 +141,6 @@ void HackadayCommunicatorKeyboard::pressed(uint8_t key)
|
|||||||
if (state == Init || state == Busy) {
|
if (state == Init || state == Busy) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_DEBUG("Key pressed: %u", key);
|
|
||||||
|
|
||||||
if (modifierFlag && (millis() - last_modifier_time > _TCA8418_MULTI_TAP_THRESHOLD)) {
|
if (modifierFlag && (millis() - last_modifier_time > _TCA8418_MULTI_TAP_THRESHOLD)) {
|
||||||
modifierFlag = 0;
|
modifierFlag = 0;
|
||||||
|
|||||||
@@ -27,11 +27,6 @@ enum input_broker_event {
|
|||||||
INPUT_BROKER_SHUTDOWN = 0x9b,
|
INPUT_BROKER_SHUTDOWN = 0x9b,
|
||||||
INPUT_BROKER_GPS_TOGGLE = 0x9e,
|
INPUT_BROKER_GPS_TOGGLE = 0x9e,
|
||||||
INPUT_BROKER_SEND_PING = 0xaf,
|
INPUT_BROKER_SEND_PING = 0xaf,
|
||||||
INPUT_BROKER_FN_F1 = 0xf1,
|
|
||||||
INPUT_BROKER_FN_F2 = 0xf2,
|
|
||||||
INPUT_BROKER_FN_F3 = 0xf3,
|
|
||||||
INPUT_BROKER_FN_F4 = 0xf4,
|
|
||||||
INPUT_BROKER_FN_F5 = 0xf5,
|
|
||||||
INPUT_BROKER_MATRIXKEY = 0xFE,
|
INPUT_BROKER_MATRIXKEY = 0xFE,
|
||||||
INPUT_BROKER_ANYKEY = 0xff
|
INPUT_BROKER_ANYKEY = 0xff
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,7 @@ class TCA8418KeyboardBase
|
|||||||
GPS_TOGGLE = 0x9E,
|
GPS_TOGGLE = 0x9E,
|
||||||
MUTE_TOGGLE = 0xAC,
|
MUTE_TOGGLE = 0xAC,
|
||||||
SEND_PING = 0xAF,
|
SEND_PING = 0xAF,
|
||||||
BL_TOGGLE = 0xAB,
|
BL_TOGGLE = 0xAB
|
||||||
FUNCTION_F1 = 0xF1,
|
|
||||||
FUNCTION_F2 = 0xF2,
|
|
||||||
FUNCTION_F3 = 0xF3,
|
|
||||||
FUNCTION_F4 = 0xF4,
|
|
||||||
FUNCTION_F5 = 0xF5
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef uint8_t (*i2c_com_fptr_t)(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data, uint8_t len);
|
typedef uint8_t (*i2c_com_fptr_t)(uint8_t dev_addr, uint8_t reg_addr, uint8_t *data, uint8_t len);
|
||||||
|
|||||||
@@ -321,26 +321,6 @@ int32_t KbI2cBase::runOnce()
|
|||||||
e.inputEvent = INPUT_BROKER_ANYKEY;
|
e.inputEvent = INPUT_BROKER_ANYKEY;
|
||||||
e.kbchar = INPUT_BROKER_MSG_TAB;
|
e.kbchar = INPUT_BROKER_MSG_TAB;
|
||||||
break;
|
break;
|
||||||
case TCA8418KeyboardBase::FUNCTION_F1:
|
|
||||||
e.inputEvent = INPUT_BROKER_FN_F1;
|
|
||||||
e.kbchar = 0x00;
|
|
||||||
break;
|
|
||||||
case TCA8418KeyboardBase::FUNCTION_F2:
|
|
||||||
e.inputEvent = INPUT_BROKER_FN_F2;
|
|
||||||
e.kbchar = 0x00;
|
|
||||||
break;
|
|
||||||
case TCA8418KeyboardBase::FUNCTION_F3:
|
|
||||||
e.inputEvent = INPUT_BROKER_FN_F3;
|
|
||||||
e.kbchar = 0x00;
|
|
||||||
break;
|
|
||||||
case TCA8418KeyboardBase::FUNCTION_F4:
|
|
||||||
e.inputEvent = INPUT_BROKER_FN_F4;
|
|
||||||
e.kbchar = 0x00;
|
|
||||||
break;
|
|
||||||
case TCA8418KeyboardBase::FUNCTION_F5:
|
|
||||||
e.inputEvent = INPUT_BROKER_FN_F5;
|
|
||||||
e.kbchar = 0x00;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (nextEvent > 127) {
|
if (nextEvent > 127) {
|
||||||
e.inputEvent = INPUT_BROKER_NONE;
|
e.inputEvent = INPUT_BROKER_NONE;
|
||||||
|
|||||||
39
src/main.cpp
39
src/main.cpp
@@ -1401,43 +1401,7 @@ void loop()
|
|||||||
if (inputBroker)
|
if (inputBroker)
|
||||||
inputBroker->processInputEventQueue();
|
inputBroker->processInputEventQueue();
|
||||||
#endif
|
#endif
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO && HAS_TFT
|
||||||
if (portduino_config.lora_spi_dev == "ch341" && ch341Hal != nullptr) {
|
|
||||||
ch341Hal->checkError();
|
|
||||||
}
|
|
||||||
if (portduino_status.LoRa_in_error && rebootAtMsec == 0) {
|
|
||||||
LOG_ERROR("LoRa in error detected, attempting to recover");
|
|
||||||
if (rIf != nullptr) {
|
|
||||||
delete rIf;
|
|
||||||
rIf = nullptr;
|
|
||||||
}
|
|
||||||
if (portduino_config.lora_spi_dev == "ch341") {
|
|
||||||
if (ch341Hal != nullptr) {
|
|
||||||
delete ch341Hal;
|
|
||||||
ch341Hal = nullptr;
|
|
||||||
sleep(3);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
ch341Hal = new Ch341Hal(0, portduino_config.lora_usb_serial_num, portduino_config.lora_usb_vid,
|
|
||||||
portduino_config.lora_usb_pid);
|
|
||||||
} catch (std::exception &e) {
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
std::cerr << "Could not initialize CH341 device!" << std::endl;
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (initLoRa()) {
|
|
||||||
router->addInterface(rIf);
|
|
||||||
portduino_status.LoRa_in_error = false;
|
|
||||||
} else {
|
|
||||||
LOG_WARN("Reconfigure failed, rebooting");
|
|
||||||
if (screen) {
|
|
||||||
screen->showSimpleBanner("Rebooting...");
|
|
||||||
}
|
|
||||||
rebootAtMsec = millis() + 25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if HAS_TFT
|
|
||||||
if (screen && portduino_config.displayPanel == x11 &&
|
if (screen && portduino_config.displayPanel == x11 &&
|
||||||
config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
|
config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
|
||||||
auto dispdev = screen->getDisplayDevice();
|
auto dispdev = screen->getDisplayDevice();
|
||||||
@@ -1445,7 +1409,6 @@ void loop()
|
|||||||
static_cast<TFTDisplay *>(dispdev)->sdlLoop();
|
static_cast<TFTDisplay *>(dispdev)->sdlLoop();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#if HAS_SCREEN && ENABLE_MESSAGE_PERSISTENCE
|
#if HAS_SCREEN && ENABLE_MESSAGE_PERSISTENCE
|
||||||
messageStoreAutosaveTick();
|
messageStoreAutosaveTick();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2247,10 +2247,7 @@ void recordCriticalError(meshtastic_CriticalErrorCode code, uint32_t address, co
|
|||||||
|
|
||||||
// Currently portuino is mostly used for simulation. Make sure the user notices something really bad happened
|
// Currently portuino is mostly used for simulation. Make sure the user notices something really bad happened
|
||||||
#ifdef ARCH_PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
LOG_ERROR("A critical failure occurred");
|
LOG_ERROR("A critical failure occurred, portduino is exiting");
|
||||||
// TODO: Determine if other critical errors should also cause an immediate exit
|
exit(2);
|
||||||
if (code == meshtastic_CriticalErrorCode_FLASH_CORRUPTION_RECOVERABLE ||
|
|
||||||
code == meshtastic_CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE)
|
|
||||||
exit(2);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -269,12 +269,8 @@ template <typename T> void SX126xInterface<T>::setStandby()
|
|||||||
|
|
||||||
if (err != RADIOLIB_ERR_NONE)
|
if (err != RADIOLIB_ERR_NONE)
|
||||||
LOG_DEBUG("SX126x standby %s%d", radioLibErr, err);
|
LOG_DEBUG("SX126x standby %s%d", radioLibErr, err);
|
||||||
#ifdef ARCH_PORTDUINO
|
|
||||||
if (err != RADIOLIB_ERR_NONE)
|
|
||||||
portduino_status.LoRa_in_error = true;
|
|
||||||
#else
|
|
||||||
assert(err == RADIOLIB_ERR_NONE);
|
assert(err == RADIOLIB_ERR_NONE);
|
||||||
#endif
|
|
||||||
isReceiving = false; // If we were receiving, not any more
|
isReceiving = false; // If we were receiving, not any more
|
||||||
activeReceiveStart = 0;
|
activeReceiveStart = 0;
|
||||||
disableInterrupt();
|
disableInterrupt();
|
||||||
@@ -317,12 +313,7 @@ template <typename T> void SX126xInterface<T>::startReceive()
|
|||||||
int err = lora.startReceiveDutyCycleAuto(preambleLength, 8, MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS);
|
int err = lora.startReceiveDutyCycleAuto(preambleLength, 8, MESHTASTIC_RADIOLIB_IRQ_RX_FLAGS);
|
||||||
if (err != RADIOLIB_ERR_NONE)
|
if (err != RADIOLIB_ERR_NONE)
|
||||||
LOG_ERROR("SX126X startReceiveDutyCycleAuto %s%d", radioLibErr, err);
|
LOG_ERROR("SX126X startReceiveDutyCycleAuto %s%d", radioLibErr, err);
|
||||||
#ifdef ARCH_PORTDUINO
|
|
||||||
if (err != RADIOLIB_ERR_NONE)
|
|
||||||
portduino_status.LoRa_in_error = true;
|
|
||||||
#else
|
|
||||||
assert(err == RADIOLIB_ERR_NONE);
|
assert(err == RADIOLIB_ERR_NONE);
|
||||||
#endif
|
|
||||||
|
|
||||||
RadioLibInterface::startReceive();
|
RadioLibInterface::startReceive();
|
||||||
|
|
||||||
@@ -350,12 +341,7 @@ template <typename T> bool SX126xInterface<T>::isChannelActive()
|
|||||||
return true;
|
return true;
|
||||||
if (result != RADIOLIB_CHANNEL_FREE)
|
if (result != RADIOLIB_CHANNEL_FREE)
|
||||||
LOG_ERROR("SX126X scanChannel %s%d", radioLibErr, result);
|
LOG_ERROR("SX126X scanChannel %s%d", radioLibErr, result);
|
||||||
#ifdef ARCH_PORTDUINO
|
|
||||||
if (result == RADIOLIB_ERR_WRONG_MODEM)
|
|
||||||
portduino_status.LoRa_in_error = true;
|
|
||||||
#else
|
|
||||||
assert(result != RADIOLIB_ERR_WRONG_MODEM);
|
assert(result != RADIOLIB_ERR_WRONG_MODEM);
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,15 +27,6 @@ PB_BIND(meshtastic_SharedContact, meshtastic_SharedContact, AUTO)
|
|||||||
PB_BIND(meshtastic_KeyVerificationAdmin, meshtastic_KeyVerificationAdmin, AUTO)
|
PB_BIND(meshtastic_KeyVerificationAdmin, meshtastic_KeyVerificationAdmin, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_SensorConfig, meshtastic_SensorConfig, AUTO)
|
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_SCD4X_config, meshtastic_SCD4X_config, AUTO)
|
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_SEN5X_config, meshtastic_SEN5X_config, AUTO)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -171,48 +171,6 @@ typedef struct _meshtastic_KeyVerificationAdmin {
|
|||||||
uint32_t security_number;
|
uint32_t security_number;
|
||||||
} meshtastic_KeyVerificationAdmin;
|
} meshtastic_KeyVerificationAdmin;
|
||||||
|
|
||||||
typedef struct _meshtastic_SCD4X_config {
|
|
||||||
/* Set Automatic self-calibration enabled */
|
|
||||||
bool has_set_asc;
|
|
||||||
bool set_asc;
|
|
||||||
/* Recalibration target CO2 concentration in ppm (FRC or ASC) */
|
|
||||||
bool has_set_target_co2_conc;
|
|
||||||
uint32_t set_target_co2_conc;
|
|
||||||
/* Reference temperature in degC */
|
|
||||||
bool has_set_temperature;
|
|
||||||
float set_temperature;
|
|
||||||
/* Altitude of sensor in meters above sea level. 0 - 3000m (overrides ambient pressure) */
|
|
||||||
bool has_set_altitude;
|
|
||||||
uint32_t set_altitude;
|
|
||||||
/* Sensor ambient pressure in Pa. 70000 - 120000 Pa (overrides altitude) */
|
|
||||||
bool has_set_ambient_pressure;
|
|
||||||
uint32_t set_ambient_pressure;
|
|
||||||
/* Perform a factory reset of the sensor */
|
|
||||||
bool has_factory_reset;
|
|
||||||
bool factory_reset;
|
|
||||||
/* Power mode for sensor (true for low power, false for normal) */
|
|
||||||
bool has_set_power_mode;
|
|
||||||
bool set_power_mode;
|
|
||||||
} meshtastic_SCD4X_config;
|
|
||||||
|
|
||||||
typedef struct _meshtastic_SEN5X_config {
|
|
||||||
/* Reference temperature in degC */
|
|
||||||
bool has_set_temperature;
|
|
||||||
float set_temperature;
|
|
||||||
/* One-shot mode (true for low power - one-shot mode, false for normal - continuous mode) */
|
|
||||||
bool has_set_one_shot_mode;
|
|
||||||
bool set_one_shot_mode;
|
|
||||||
} meshtastic_SEN5X_config;
|
|
||||||
|
|
||||||
typedef struct _meshtastic_SensorConfig {
|
|
||||||
/* SCD4X CO2 Sensor configuration */
|
|
||||||
bool has_scd4x_config;
|
|
||||||
meshtastic_SCD4X_config scd4x_config;
|
|
||||||
/* SEN5X PM Sensor configuration */
|
|
||||||
bool has_sen5x_config;
|
|
||||||
meshtastic_SEN5X_config sen5x_config;
|
|
||||||
} meshtastic_SensorConfig;
|
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(8) meshtastic_AdminMessage_session_passkey_t;
|
typedef PB_BYTES_ARRAY_T(8) meshtastic_AdminMessage_session_passkey_t;
|
||||||
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
|
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
|
||||||
This message is used to do settings operations to both remote AND local nodes.
|
This message is used to do settings operations to both remote AND local nodes.
|
||||||
@@ -345,8 +303,6 @@ typedef struct _meshtastic_AdminMessage {
|
|||||||
bool nodedb_reset;
|
bool nodedb_reset;
|
||||||
/* Tell the node to reset into the OTA Loader */
|
/* Tell the node to reset into the OTA Loader */
|
||||||
meshtastic_AdminMessage_OTAEvent ota_request;
|
meshtastic_AdminMessage_OTAEvent ota_request;
|
||||||
/* Parameters and sensor configuration */
|
|
||||||
meshtastic_SensorConfig sensor_config;
|
|
||||||
};
|
};
|
||||||
/* The node generates this key and sends it with any get_x_response packets.
|
/* The node generates this key and sends it with any get_x_response packets.
|
||||||
The client MUST include the same key with any set_x commands. Key expires after 300 seconds.
|
The client MUST include the same key with any set_x commands. Key expires after 300 seconds.
|
||||||
@@ -395,9 +351,6 @@ extern "C" {
|
|||||||
#define meshtastic_KeyVerificationAdmin_message_type_ENUMTYPE meshtastic_KeyVerificationAdmin_MessageType
|
#define meshtastic_KeyVerificationAdmin_message_type_ENUMTYPE meshtastic_KeyVerificationAdmin_MessageType
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_AdminMessage_init_default {0, {0}, {0, {0}}}
|
#define meshtastic_AdminMessage_init_default {0, {0}, {0, {0}}}
|
||||||
#define meshtastic_AdminMessage_InputEvent_init_default {0, 0, 0, 0}
|
#define meshtastic_AdminMessage_InputEvent_init_default {0, 0, 0, 0}
|
||||||
@@ -406,9 +359,6 @@ extern "C" {
|
|||||||
#define meshtastic_NodeRemoteHardwarePinsResponse_init_default {0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}}
|
#define meshtastic_NodeRemoteHardwarePinsResponse_init_default {0, {meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default, meshtastic_NodeRemoteHardwarePin_init_default}}
|
||||||
#define meshtastic_SharedContact_init_default {0, false, meshtastic_User_init_default, 0, 0}
|
#define meshtastic_SharedContact_init_default {0, false, meshtastic_User_init_default, 0, 0}
|
||||||
#define meshtastic_KeyVerificationAdmin_init_default {_meshtastic_KeyVerificationAdmin_MessageType_MIN, 0, 0, false, 0}
|
#define meshtastic_KeyVerificationAdmin_init_default {_meshtastic_KeyVerificationAdmin_MessageType_MIN, 0, 0, false, 0}
|
||||||
#define meshtastic_SensorConfig_init_default {false, meshtastic_SCD4X_config_init_default, false, meshtastic_SEN5X_config_init_default}
|
|
||||||
#define meshtastic_SCD4X_config_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
|
||||||
#define meshtastic_SEN5X_config_init_default {false, 0, false, 0}
|
|
||||||
#define meshtastic_AdminMessage_init_zero {0, {0}, {0, {0}}}
|
#define meshtastic_AdminMessage_init_zero {0, {0}, {0, {0}}}
|
||||||
#define meshtastic_AdminMessage_InputEvent_init_zero {0, 0, 0, 0}
|
#define meshtastic_AdminMessage_InputEvent_init_zero {0, 0, 0, 0}
|
||||||
#define meshtastic_AdminMessage_OTAEvent_init_zero {_meshtastic_OTAMode_MIN, {0, {0}}}
|
#define meshtastic_AdminMessage_OTAEvent_init_zero {_meshtastic_OTAMode_MIN, {0, {0}}}
|
||||||
@@ -416,9 +366,6 @@ extern "C" {
|
|||||||
#define meshtastic_NodeRemoteHardwarePinsResponse_init_zero {0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}}
|
#define meshtastic_NodeRemoteHardwarePinsResponse_init_zero {0, {meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero, meshtastic_NodeRemoteHardwarePin_init_zero}}
|
||||||
#define meshtastic_SharedContact_init_zero {0, false, meshtastic_User_init_zero, 0, 0}
|
#define meshtastic_SharedContact_init_zero {0, false, meshtastic_User_init_zero, 0, 0}
|
||||||
#define meshtastic_KeyVerificationAdmin_init_zero {_meshtastic_KeyVerificationAdmin_MessageType_MIN, 0, 0, false, 0}
|
#define meshtastic_KeyVerificationAdmin_init_zero {_meshtastic_KeyVerificationAdmin_MessageType_MIN, 0, 0, false, 0}
|
||||||
#define meshtastic_SensorConfig_init_zero {false, meshtastic_SCD4X_config_init_zero, false, meshtastic_SEN5X_config_init_zero}
|
|
||||||
#define meshtastic_SCD4X_config_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
|
||||||
#define meshtastic_SEN5X_config_init_zero {false, 0, false, 0}
|
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_AdminMessage_InputEvent_event_code_tag 1
|
#define meshtastic_AdminMessage_InputEvent_event_code_tag 1
|
||||||
@@ -440,17 +387,6 @@ extern "C" {
|
|||||||
#define meshtastic_KeyVerificationAdmin_remote_nodenum_tag 2
|
#define meshtastic_KeyVerificationAdmin_remote_nodenum_tag 2
|
||||||
#define meshtastic_KeyVerificationAdmin_nonce_tag 3
|
#define meshtastic_KeyVerificationAdmin_nonce_tag 3
|
||||||
#define meshtastic_KeyVerificationAdmin_security_number_tag 4
|
#define meshtastic_KeyVerificationAdmin_security_number_tag 4
|
||||||
#define meshtastic_SCD4X_config_set_asc_tag 1
|
|
||||||
#define meshtastic_SCD4X_config_set_target_co2_conc_tag 2
|
|
||||||
#define meshtastic_SCD4X_config_set_temperature_tag 3
|
|
||||||
#define meshtastic_SCD4X_config_set_altitude_tag 4
|
|
||||||
#define meshtastic_SCD4X_config_set_ambient_pressure_tag 5
|
|
||||||
#define meshtastic_SCD4X_config_factory_reset_tag 6
|
|
||||||
#define meshtastic_SCD4X_config_set_power_mode_tag 7
|
|
||||||
#define meshtastic_SEN5X_config_set_temperature_tag 1
|
|
||||||
#define meshtastic_SEN5X_config_set_one_shot_mode_tag 2
|
|
||||||
#define meshtastic_SensorConfig_scd4x_config_tag 1
|
|
||||||
#define meshtastic_SensorConfig_sen5x_config_tag 2
|
|
||||||
#define meshtastic_AdminMessage_get_channel_request_tag 1
|
#define meshtastic_AdminMessage_get_channel_request_tag 1
|
||||||
#define meshtastic_AdminMessage_get_channel_response_tag 2
|
#define meshtastic_AdminMessage_get_channel_response_tag 2
|
||||||
#define meshtastic_AdminMessage_get_owner_request_tag 3
|
#define meshtastic_AdminMessage_get_owner_request_tag 3
|
||||||
@@ -507,7 +443,6 @@ extern "C" {
|
|||||||
#define meshtastic_AdminMessage_factory_reset_config_tag 99
|
#define meshtastic_AdminMessage_factory_reset_config_tag 99
|
||||||
#define meshtastic_AdminMessage_nodedb_reset_tag 100
|
#define meshtastic_AdminMessage_nodedb_reset_tag 100
|
||||||
#define meshtastic_AdminMessage_ota_request_tag 102
|
#define meshtastic_AdminMessage_ota_request_tag 102
|
||||||
#define meshtastic_AdminMessage_sensor_config_tag 103
|
|
||||||
#define meshtastic_AdminMessage_session_passkey_tag 101
|
#define meshtastic_AdminMessage_session_passkey_tag 101
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
@@ -568,8 +503,7 @@ X(a, STATIC, ONEOF, INT32, (payload_variant,shutdown_seconds,shutdown_se
|
|||||||
X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset_config,factory_reset_config), 99) \
|
X(a, STATIC, ONEOF, INT32, (payload_variant,factory_reset_config,factory_reset_config), 99) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (payload_variant,nodedb_reset,nodedb_reset), 100) \
|
X(a, STATIC, ONEOF, BOOL, (payload_variant,nodedb_reset,nodedb_reset), 100) \
|
||||||
X(a, STATIC, SINGULAR, BYTES, session_passkey, 101) \
|
X(a, STATIC, SINGULAR, BYTES, session_passkey, 101) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,ota_request,ota_request), 102) \
|
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,ota_request,ota_request), 102)
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (payload_variant,sensor_config,sensor_config), 103)
|
|
||||||
#define meshtastic_AdminMessage_CALLBACK NULL
|
#define meshtastic_AdminMessage_CALLBACK NULL
|
||||||
#define meshtastic_AdminMessage_DEFAULT NULL
|
#define meshtastic_AdminMessage_DEFAULT NULL
|
||||||
#define meshtastic_AdminMessage_payload_variant_get_channel_response_MSGTYPE meshtastic_Channel
|
#define meshtastic_AdminMessage_payload_variant_get_channel_response_MSGTYPE meshtastic_Channel
|
||||||
@@ -591,7 +525,6 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,sensor_config,sensor_config)
|
|||||||
#define meshtastic_AdminMessage_payload_variant_add_contact_MSGTYPE meshtastic_SharedContact
|
#define meshtastic_AdminMessage_payload_variant_add_contact_MSGTYPE meshtastic_SharedContact
|
||||||
#define meshtastic_AdminMessage_payload_variant_key_verification_MSGTYPE meshtastic_KeyVerificationAdmin
|
#define meshtastic_AdminMessage_payload_variant_key_verification_MSGTYPE meshtastic_KeyVerificationAdmin
|
||||||
#define meshtastic_AdminMessage_payload_variant_ota_request_MSGTYPE meshtastic_AdminMessage_OTAEvent
|
#define meshtastic_AdminMessage_payload_variant_ota_request_MSGTYPE meshtastic_AdminMessage_OTAEvent
|
||||||
#define meshtastic_AdminMessage_payload_variant_sensor_config_MSGTYPE meshtastic_SensorConfig
|
|
||||||
|
|
||||||
#define meshtastic_AdminMessage_InputEvent_FIELDLIST(X, a) \
|
#define meshtastic_AdminMessage_InputEvent_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, event_code, 1) \
|
X(a, STATIC, SINGULAR, UINT32, event_code, 1) \
|
||||||
@@ -638,31 +571,6 @@ X(a, STATIC, OPTIONAL, UINT32, security_number, 4)
|
|||||||
#define meshtastic_KeyVerificationAdmin_CALLBACK NULL
|
#define meshtastic_KeyVerificationAdmin_CALLBACK NULL
|
||||||
#define meshtastic_KeyVerificationAdmin_DEFAULT NULL
|
#define meshtastic_KeyVerificationAdmin_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_SensorConfig_FIELDLIST(X, a) \
|
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, scd4x_config, 1) \
|
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, sen5x_config, 2)
|
|
||||||
#define meshtastic_SensorConfig_CALLBACK NULL
|
|
||||||
#define meshtastic_SensorConfig_DEFAULT NULL
|
|
||||||
#define meshtastic_SensorConfig_scd4x_config_MSGTYPE meshtastic_SCD4X_config
|
|
||||||
#define meshtastic_SensorConfig_sen5x_config_MSGTYPE meshtastic_SEN5X_config
|
|
||||||
|
|
||||||
#define meshtastic_SCD4X_config_FIELDLIST(X, a) \
|
|
||||||
X(a, STATIC, OPTIONAL, BOOL, set_asc, 1) \
|
|
||||||
X(a, STATIC, OPTIONAL, UINT32, set_target_co2_conc, 2) \
|
|
||||||
X(a, STATIC, OPTIONAL, FLOAT, set_temperature, 3) \
|
|
||||||
X(a, STATIC, OPTIONAL, UINT32, set_altitude, 4) \
|
|
||||||
X(a, STATIC, OPTIONAL, UINT32, set_ambient_pressure, 5) \
|
|
||||||
X(a, STATIC, OPTIONAL, BOOL, factory_reset, 6) \
|
|
||||||
X(a, STATIC, OPTIONAL, BOOL, set_power_mode, 7)
|
|
||||||
#define meshtastic_SCD4X_config_CALLBACK NULL
|
|
||||||
#define meshtastic_SCD4X_config_DEFAULT NULL
|
|
||||||
|
|
||||||
#define meshtastic_SEN5X_config_FIELDLIST(X, a) \
|
|
||||||
X(a, STATIC, OPTIONAL, FLOAT, set_temperature, 1) \
|
|
||||||
X(a, STATIC, OPTIONAL, BOOL, set_one_shot_mode, 2)
|
|
||||||
#define meshtastic_SEN5X_config_CALLBACK NULL
|
|
||||||
#define meshtastic_SEN5X_config_DEFAULT NULL
|
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_AdminMessage_msg;
|
extern const pb_msgdesc_t meshtastic_AdminMessage_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_AdminMessage_InputEvent_msg;
|
extern const pb_msgdesc_t meshtastic_AdminMessage_InputEvent_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_AdminMessage_OTAEvent_msg;
|
extern const pb_msgdesc_t meshtastic_AdminMessage_OTAEvent_msg;
|
||||||
@@ -670,9 +578,6 @@ extern const pb_msgdesc_t meshtastic_HamParameters_msg;
|
|||||||
extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePinsResponse_msg;
|
extern const pb_msgdesc_t meshtastic_NodeRemoteHardwarePinsResponse_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_SharedContact_msg;
|
extern const pb_msgdesc_t meshtastic_SharedContact_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_KeyVerificationAdmin_msg;
|
extern const pb_msgdesc_t meshtastic_KeyVerificationAdmin_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_SensorConfig_msg;
|
|
||||||
extern const pb_msgdesc_t meshtastic_SCD4X_config_msg;
|
|
||||||
extern const pb_msgdesc_t meshtastic_SEN5X_config_msg;
|
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg
|
#define meshtastic_AdminMessage_fields &meshtastic_AdminMessage_msg
|
||||||
@@ -682,9 +587,6 @@ extern const pb_msgdesc_t meshtastic_SEN5X_config_msg;
|
|||||||
#define meshtastic_NodeRemoteHardwarePinsResponse_fields &meshtastic_NodeRemoteHardwarePinsResponse_msg
|
#define meshtastic_NodeRemoteHardwarePinsResponse_fields &meshtastic_NodeRemoteHardwarePinsResponse_msg
|
||||||
#define meshtastic_SharedContact_fields &meshtastic_SharedContact_msg
|
#define meshtastic_SharedContact_fields &meshtastic_SharedContact_msg
|
||||||
#define meshtastic_KeyVerificationAdmin_fields &meshtastic_KeyVerificationAdmin_msg
|
#define meshtastic_KeyVerificationAdmin_fields &meshtastic_KeyVerificationAdmin_msg
|
||||||
#define meshtastic_SensorConfig_fields &meshtastic_SensorConfig_msg
|
|
||||||
#define meshtastic_SCD4X_config_fields &meshtastic_SCD4X_config_msg
|
|
||||||
#define meshtastic_SEN5X_config_fields &meshtastic_SEN5X_config_msg
|
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_ADMIN_PB_H_MAX_SIZE meshtastic_AdminMessage_size
|
#define MESHTASTIC_MESHTASTIC_ADMIN_PB_H_MAX_SIZE meshtastic_AdminMessage_size
|
||||||
@@ -694,9 +596,6 @@ extern const pb_msgdesc_t meshtastic_SEN5X_config_msg;
|
|||||||
#define meshtastic_HamParameters_size 31
|
#define meshtastic_HamParameters_size 31
|
||||||
#define meshtastic_KeyVerificationAdmin_size 25
|
#define meshtastic_KeyVerificationAdmin_size 25
|
||||||
#define meshtastic_NodeRemoteHardwarePinsResponse_size 496
|
#define meshtastic_NodeRemoteHardwarePinsResponse_size 496
|
||||||
#define meshtastic_SCD4X_config_size 29
|
|
||||||
#define meshtastic_SEN5X_config_size 7
|
|
||||||
#define meshtastic_SensorConfig_size 40
|
|
||||||
#define meshtastic_SharedContact_size 127
|
#define meshtastic_SharedContact_size 127
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -33,9 +33,6 @@ PB_BIND(meshtastic_Telemetry, meshtastic_Telemetry, 2)
|
|||||||
PB_BIND(meshtastic_Nau7802Config, meshtastic_Nau7802Config, AUTO)
|
PB_BIND(meshtastic_Nau7802Config, meshtastic_Nau7802Config, AUTO)
|
||||||
|
|
||||||
|
|
||||||
PB_BIND(meshtastic_SEN5XState, meshtastic_SEN5XState, AUTO)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -435,25 +435,6 @@ typedef struct _meshtastic_Nau7802Config {
|
|||||||
float calibrationFactor;
|
float calibrationFactor;
|
||||||
} meshtastic_Nau7802Config;
|
} meshtastic_Nau7802Config;
|
||||||
|
|
||||||
/* SEN5X State, for saving to flash */
|
|
||||||
typedef struct _meshtastic_SEN5XState {
|
|
||||||
/* Last cleaning time for SEN5X */
|
|
||||||
uint32_t last_cleaning_time;
|
|
||||||
/* Last cleaning time for SEN5X - valid flag */
|
|
||||||
bool last_cleaning_valid;
|
|
||||||
/* Config flag for one-shot mode (see admin.proto) */
|
|
||||||
bool one_shot_mode;
|
|
||||||
/* Last VOC state time for SEN55 */
|
|
||||||
bool has_voc_state_time;
|
|
||||||
uint32_t voc_state_time;
|
|
||||||
/* Last VOC state validity flag for SEN55 */
|
|
||||||
bool has_voc_state_valid;
|
|
||||||
bool voc_state_valid;
|
|
||||||
/* VOC state array (8x uint8t) for SEN55 */
|
|
||||||
bool has_voc_state_array;
|
|
||||||
uint64_t voc_state_array;
|
|
||||||
} meshtastic_SEN5XState;
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -474,7 +455,6 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define meshtastic_DeviceMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_DeviceMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_EnvironmentMetrics_init_default {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
@@ -485,7 +465,6 @@ extern "C" {
|
|||||||
#define meshtastic_HostMetrics_init_default {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""}
|
#define meshtastic_HostMetrics_init_default {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""}
|
||||||
#define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}}
|
#define meshtastic_Telemetry_init_default {0, 0, {meshtastic_DeviceMetrics_init_default}}
|
||||||
#define meshtastic_Nau7802Config_init_default {0, 0}
|
#define meshtastic_Nau7802Config_init_default {0, 0}
|
||||||
#define meshtastic_SEN5XState_init_default {0, 0, 0, false, 0, false, 0, false, 0}
|
|
||||||
#define meshtastic_DeviceMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_DeviceMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_EnvironmentMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
#define meshtastic_PowerMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
#define meshtastic_PowerMetrics_init_zero {false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0, false, 0}
|
||||||
@@ -495,7 +474,6 @@ extern "C" {
|
|||||||
#define meshtastic_HostMetrics_init_zero {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""}
|
#define meshtastic_HostMetrics_init_zero {0, 0, 0, false, 0, false, 0, 0, 0, 0, false, ""}
|
||||||
#define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}}
|
#define meshtastic_Telemetry_init_zero {0, 0, {meshtastic_DeviceMetrics_init_zero}}
|
||||||
#define meshtastic_Nau7802Config_init_zero {0, 0}
|
#define meshtastic_Nau7802Config_init_zero {0, 0}
|
||||||
#define meshtastic_SEN5XState_init_zero {0, 0, 0, false, 0, false, 0, false, 0}
|
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define meshtastic_DeviceMetrics_battery_level_tag 1
|
#define meshtastic_DeviceMetrics_battery_level_tag 1
|
||||||
@@ -603,12 +581,6 @@ extern "C" {
|
|||||||
#define meshtastic_Telemetry_host_metrics_tag 8
|
#define meshtastic_Telemetry_host_metrics_tag 8
|
||||||
#define meshtastic_Nau7802Config_zeroOffset_tag 1
|
#define meshtastic_Nau7802Config_zeroOffset_tag 1
|
||||||
#define meshtastic_Nau7802Config_calibrationFactor_tag 2
|
#define meshtastic_Nau7802Config_calibrationFactor_tag 2
|
||||||
#define meshtastic_SEN5XState_last_cleaning_time_tag 1
|
|
||||||
#define meshtastic_SEN5XState_last_cleaning_valid_tag 2
|
|
||||||
#define meshtastic_SEN5XState_one_shot_mode_tag 3
|
|
||||||
#define meshtastic_SEN5XState_voc_state_time_tag 4
|
|
||||||
#define meshtastic_SEN5XState_voc_state_valid_tag 5
|
|
||||||
#define meshtastic_SEN5XState_voc_state_array_tag 6
|
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
#define meshtastic_DeviceMetrics_FIELDLIST(X, a) \
|
#define meshtastic_DeviceMetrics_FIELDLIST(X, a) \
|
||||||
@@ -759,16 +731,6 @@ X(a, STATIC, SINGULAR, FLOAT, calibrationFactor, 2)
|
|||||||
#define meshtastic_Nau7802Config_CALLBACK NULL
|
#define meshtastic_Nau7802Config_CALLBACK NULL
|
||||||
#define meshtastic_Nau7802Config_DEFAULT NULL
|
#define meshtastic_Nau7802Config_DEFAULT NULL
|
||||||
|
|
||||||
#define meshtastic_SEN5XState_FIELDLIST(X, a) \
|
|
||||||
X(a, STATIC, SINGULAR, UINT32, last_cleaning_time, 1) \
|
|
||||||
X(a, STATIC, SINGULAR, BOOL, last_cleaning_valid, 2) \
|
|
||||||
X(a, STATIC, SINGULAR, BOOL, one_shot_mode, 3) \
|
|
||||||
X(a, STATIC, OPTIONAL, UINT32, voc_state_time, 4) \
|
|
||||||
X(a, STATIC, OPTIONAL, BOOL, voc_state_valid, 5) \
|
|
||||||
X(a, STATIC, OPTIONAL, FIXED64, voc_state_array, 6)
|
|
||||||
#define meshtastic_SEN5XState_CALLBACK NULL
|
|
||||||
#define meshtastic_SEN5XState_DEFAULT NULL
|
|
||||||
|
|
||||||
extern const pb_msgdesc_t meshtastic_DeviceMetrics_msg;
|
extern const pb_msgdesc_t meshtastic_DeviceMetrics_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_EnvironmentMetrics_msg;
|
extern const pb_msgdesc_t meshtastic_EnvironmentMetrics_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_PowerMetrics_msg;
|
extern const pb_msgdesc_t meshtastic_PowerMetrics_msg;
|
||||||
@@ -778,7 +740,6 @@ extern const pb_msgdesc_t meshtastic_HealthMetrics_msg;
|
|||||||
extern const pb_msgdesc_t meshtastic_HostMetrics_msg;
|
extern const pb_msgdesc_t meshtastic_HostMetrics_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_Telemetry_msg;
|
extern const pb_msgdesc_t meshtastic_Telemetry_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_Nau7802Config_msg;
|
extern const pb_msgdesc_t meshtastic_Nau7802Config_msg;
|
||||||
extern const pb_msgdesc_t meshtastic_SEN5XState_msg;
|
|
||||||
|
|
||||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
#define meshtastic_DeviceMetrics_fields &meshtastic_DeviceMetrics_msg
|
#define meshtastic_DeviceMetrics_fields &meshtastic_DeviceMetrics_msg
|
||||||
@@ -790,7 +751,6 @@ extern const pb_msgdesc_t meshtastic_SEN5XState_msg;
|
|||||||
#define meshtastic_HostMetrics_fields &meshtastic_HostMetrics_msg
|
#define meshtastic_HostMetrics_fields &meshtastic_HostMetrics_msg
|
||||||
#define meshtastic_Telemetry_fields &meshtastic_Telemetry_msg
|
#define meshtastic_Telemetry_fields &meshtastic_Telemetry_msg
|
||||||
#define meshtastic_Nau7802Config_fields &meshtastic_Nau7802Config_msg
|
#define meshtastic_Nau7802Config_fields &meshtastic_Nau7802Config_msg
|
||||||
#define meshtastic_SEN5XState_fields &meshtastic_SEN5XState_msg
|
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size
|
#define MESHTASTIC_MESHTASTIC_TELEMETRY_PB_H_MAX_SIZE meshtastic_Telemetry_size
|
||||||
@@ -802,7 +762,6 @@ extern const pb_msgdesc_t meshtastic_SEN5XState_msg;
|
|||||||
#define meshtastic_LocalStats_size 87
|
#define meshtastic_LocalStats_size 87
|
||||||
#define meshtastic_Nau7802Config_size 16
|
#define meshtastic_Nau7802Config_size 16
|
||||||
#define meshtastic_PowerMetrics_size 81
|
#define meshtastic_PowerMetrics_size 81
|
||||||
#define meshtastic_SEN5XState_size 27
|
|
||||||
#define meshtastic_Telemetry_size 272
|
#define meshtastic_Telemetry_size 272
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -464,6 +464,22 @@ void cpuDeepSleep(uint32_t msecToWake)
|
|||||||
// FIXME, use non-init RAM per
|
// FIXME, use non-init RAM per
|
||||||
// https://devzone.nordicsemi.com/f/nordic-q-a/48919/ram-retention-settings-with-softdevice-enabled
|
// https://devzone.nordicsemi.com/f/nordic-q-a/48919/ram-retention-settings-with-softdevice-enabled
|
||||||
|
|
||||||
|
#ifdef ELECROW_ThinkNode_M1
|
||||||
|
nrf_gpio_cfg_input(PIN_BUTTON1, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input
|
||||||
|
nrf_gpio_pin_sense_t sense = NRF_GPIO_PIN_SENSE_LOW;
|
||||||
|
nrf_gpio_cfg_sense_set(PIN_BUTTON1, sense);
|
||||||
|
|
||||||
|
nrf_gpio_cfg_input(PIN_BUTTON2, NRF_GPIO_PIN_PULLUP);
|
||||||
|
nrf_gpio_pin_sense_t sense1 = NRF_GPIO_PIN_SENSE_LOW;
|
||||||
|
nrf_gpio_cfg_sense_set(PIN_BUTTON2, sense1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PROMICRO_DIY_TCXO
|
||||||
|
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); // Enable internal pull-up on the button pin
|
||||||
|
nrf_gpio_pin_sense_t sense = NRF_GPIO_PIN_SENSE_LOW; // Configure SENSE signal on low edge
|
||||||
|
nrf_gpio_cfg_sense_set(BUTTON_PIN, sense); // Apply SENSE to wake up the device from the deep sleep
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef BATTERY_LPCOMP_INPUT
|
#ifdef BATTERY_LPCOMP_INPUT
|
||||||
// Wake up if power rises again
|
// Wake up if power rises again
|
||||||
nrf_lpcomp_config_t c;
|
nrf_lpcomp_config_t c;
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <stdexcept>
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@@ -30,7 +29,6 @@
|
|||||||
#include "platform/portduino/USBHal.h"
|
#include "platform/portduino/USBHal.h"
|
||||||
|
|
||||||
portduino_config_struct portduino_config;
|
portduino_config_struct portduino_config;
|
||||||
portduino_status_struct portduino_status;
|
|
||||||
std::ofstream traceFile;
|
std::ofstream traceFile;
|
||||||
std::ofstream JSONFile;
|
std::ofstream JSONFile;
|
||||||
Ch341Hal *ch341Hal = nullptr;
|
Ch341Hal *ch341Hal = nullptr;
|
||||||
@@ -402,11 +400,6 @@ void portduinoSetup()
|
|||||||
if (found_hat) {
|
if (found_hat) {
|
||||||
product_config =
|
product_config =
|
||||||
cleanupNameForAutoconf("lora-hat-" + std::string(hat_vendor) + "-" + autoconf_product + ".yaml");
|
cleanupNameForAutoconf("lora-hat-" + std::string(hat_vendor) + "-" + autoconf_product + ".yaml");
|
||||||
if (strncmp(hat_vendor, "RAK", strlen("RAK")) == 0 &&
|
|
||||||
strncmp(autoconf_product, "6421 Pi Hat", strlen("6421 Pi Hat")) == 0) {
|
|
||||||
std::cout << "autoconf: Setting hardwareModel to RAK6421" << std::endl;
|
|
||||||
portduino_status.hardwareModel = meshtastic_HardwareModel_RAK6421;
|
|
||||||
}
|
|
||||||
} else if (found_ch341) {
|
} else if (found_ch341) {
|
||||||
product_config = cleanupNameForAutoconf("lora-usb-" + std::string(autoconf_product) + ".yaml");
|
product_config = cleanupNameForAutoconf("lora-usb-" + std::string(autoconf_product) + ".yaml");
|
||||||
// look for more data after the null terminator
|
// look for more data after the null terminator
|
||||||
@@ -415,10 +408,6 @@ void portduinoSetup()
|
|||||||
memcpy(portduino_config.device_id, autoconf_product + len + 1, 16);
|
memcpy(portduino_config.device_id, autoconf_product + len + 1, 16);
|
||||||
if (!memfll(portduino_config.device_id, '\0', 16) && !memfll(portduino_config.device_id, 0xff, 16)) {
|
if (!memfll(portduino_config.device_id, '\0', 16) && !memfll(portduino_config.device_id, 0xff, 16)) {
|
||||||
portduino_config.has_device_id = true;
|
portduino_config.has_device_id = true;
|
||||||
if (strncmp(autoconf_product, "MESHSTICK 1262", strlen("MESHSTICK 1262")) == 0) {
|
|
||||||
std::cout << "autoconf: Setting hardwareModel to Meshstick 1262" << std::endl;
|
|
||||||
portduino_status.hardwareModel = meshtastic_HardwareModel_MESHSTICK_1262;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <unistd.h>
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "LR11x0Interface.h"
|
#include "LR11x0Interface.h"
|
||||||
#include "Module.h"
|
#include "Module.h"
|
||||||
#include "mesh/generated/meshtastic/mesh.pb.h"
|
#include "mesh/generated/meshtastic/mesh.pb.h"
|
||||||
#include "yaml-cpp/yaml.h"
|
|
||||||
|
|
||||||
extern struct portduino_status_struct {
|
|
||||||
bool LoRa_in_error = false;
|
|
||||||
_meshtastic_HardwareModel hardwareModel = meshtastic_HardwareModel_PORTDUINO;
|
|
||||||
} portduino_status;
|
|
||||||
|
|
||||||
#include "platform/portduino/USBHal.h"
|
#include "platform/portduino/USBHal.h"
|
||||||
|
#include "yaml-cpp/yaml.h"
|
||||||
|
|
||||||
// Product strings for auto-configuration
|
// Product strings for auto-configuration
|
||||||
// {"PRODUCT_STRING", "CONFIG.YAML"}
|
// {"PRODUCT_STRING", "CONFIG.YAML"}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
#include <libpinedio-usb.h>
|
#include <libpinedio-usb.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
extern uint32_t rebootAtMsec;
|
|
||||||
|
|
||||||
// include the library for Raspberry GPIO pins
|
// include the library for Raspberry GPIO pins
|
||||||
|
|
||||||
#define PI_RISING (PINEDIO_INT_MODE_RISING)
|
#define PI_RISING (PINEDIO_INT_MODE_RISING)
|
||||||
@@ -47,7 +45,7 @@ class Ch341Hal : public RadioLibHal
|
|||||||
int32_t ret = pinedio_init(&pinedio, NULL);
|
int32_t ret = pinedio_init(&pinedio, NULL);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
std::string s = "Could not open SPI: ";
|
std::string s = "Could not open SPI: ";
|
||||||
throw std::runtime_error(s + std::to_string(ret));
|
throw(s + std::to_string(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
pinedio_set_option(&pinedio, PINEDIO_OPTION_AUTO_CS, 0);
|
pinedio_set_option(&pinedio, PINEDIO_OPTION_AUTO_CS, 0);
|
||||||
@@ -76,55 +74,30 @@ class Ch341Hal : public RadioLibHal
|
|||||||
// RADIOLIB_NC as an alias for non-connected pins
|
// RADIOLIB_NC as an alias for non-connected pins
|
||||||
void pinMode(uint32_t pin, uint32_t mode) override
|
void pinMode(uint32_t pin, uint32_t mode) override
|
||||||
{
|
{
|
||||||
if (checkError()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pin == RADIOLIB_NC) {
|
if (pin == RADIOLIB_NC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto res = pinedio_set_pin_mode(&pinedio, pin, mode);
|
pinedio_set_pin_mode(&pinedio, pin, mode);
|
||||||
if (res < 0 && rebootAtMsec == 0) {
|
|
||||||
LOG_ERROR("USBHal pinMode: Could not set pin %u mode to %u: %d", pin, mode, res);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void digitalWrite(uint32_t pin, uint32_t value) override
|
void digitalWrite(uint32_t pin, uint32_t value) override
|
||||||
{
|
{
|
||||||
if (checkError()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (pin == RADIOLIB_NC) {
|
if (pin == RADIOLIB_NC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto res = pinedio_digital_write(&pinedio, pin, value);
|
pinedio_digital_write(&pinedio, pin, value);
|
||||||
if (res < 0 && rebootAtMsec == 0) {
|
|
||||||
LOG_ERROR("USBHal digitalWrite: Could not write pin %u: %d", pin, res);
|
|
||||||
portduino_status.LoRa_in_error = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t digitalRead(uint32_t pin) override
|
uint32_t digitalRead(uint32_t pin) override
|
||||||
{
|
{
|
||||||
if (checkError()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (pin == RADIOLIB_NC) {
|
if (pin == RADIOLIB_NC) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
auto res = pinedio_digital_read(&pinedio, pin);
|
return pinedio_digital_read(&pinedio, pin);
|
||||||
if (res < 0 && rebootAtMsec == 0) {
|
|
||||||
LOG_ERROR("USBHal digitalRead: Could not read pin %u: %d", pin, res);
|
|
||||||
portduino_status.LoRa_in_error = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void attachInterrupt(uint32_t interruptNum, void (*interruptCb)(void), uint32_t mode) override
|
void attachInterrupt(uint32_t interruptNum, void (*interruptCb)(void), uint32_t mode) override
|
||||||
{
|
{
|
||||||
if (checkError()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (interruptNum == RADIOLIB_NC) {
|
if (interruptNum == RADIOLIB_NC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -134,9 +107,6 @@ class Ch341Hal : public RadioLibHal
|
|||||||
|
|
||||||
void detachInterrupt(uint32_t interruptNum) override
|
void detachInterrupt(uint32_t interruptNum) override
|
||||||
{
|
{
|
||||||
if (checkError()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (interruptNum == RADIOLIB_NC) {
|
if (interruptNum == RADIOLIB_NC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -182,9 +152,6 @@ class Ch341Hal : public RadioLibHal
|
|||||||
|
|
||||||
void spiTransfer(uint8_t *out, size_t len, uint8_t *in)
|
void spiTransfer(uint8_t *out, size_t len, uint8_t *in)
|
||||||
{
|
{
|
||||||
if (checkError()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int32_t ret = pinedio_transceive(&this->pinedio, out, in, len);
|
int32_t ret = pinedio_transceive(&this->pinedio, out, in, len);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
std::cerr << "Could not perform SPI transfer: " << ret << std::endl;
|
std::cerr << "Could not perform SPI transfer: " << ret << std::endl;
|
||||||
@@ -193,22 +160,9 @@ class Ch341Hal : public RadioLibHal
|
|||||||
|
|
||||||
void spiEndTransaction() {}
|
void spiEndTransaction() {}
|
||||||
void spiEnd() {}
|
void spiEnd() {}
|
||||||
bool checkError()
|
|
||||||
{
|
|
||||||
if (pinedio.in_error) {
|
|
||||||
if (!has_warned)
|
|
||||||
LOG_ERROR("USBHal: libch341 in_error detected");
|
|
||||||
portduino_status.LoRa_in_error = true;
|
|
||||||
has_warned = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
has_warned = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pinedio_inst pinedio = {0};
|
pinedio_inst pinedio = {0};
|
||||||
bool has_warned = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// set HW_VENDOR
|
// set HW_VENDOR
|
||||||
//
|
//
|
||||||
|
|
||||||
#define HW_VENDOR portduino_status.hardwareModel
|
#define HW_VENDOR meshtastic_HardwareModel_PORTDUINO
|
||||||
|
|
||||||
#ifndef HAS_BUTTON
|
#ifndef HAS_BUTTON
|
||||||
#define HAS_BUTTON 1
|
#define HAS_BUTTON 1
|
||||||
|
|||||||
@@ -1,17 +1,8 @@
|
|||||||
[env:heltec-wireless-tracker-v2]
|
[env:heltec-wireless-tracker-v2]
|
||||||
custom_meshtastic_support_level = 1
|
|
||||||
custom_meshtastic_images = heltec_wireless_tracker_v2.svg
|
|
||||||
custom_meshtastic_tags = Heltec
|
|
||||||
|
|
||||||
extends = esp32s3_base
|
extends = esp32s3_base
|
||||||
board = heltec_wireless_tracker_v2
|
board = heltec_wireless_tracker_v2
|
||||||
board_build.partitions = default_8MB.csv
|
board_build.partitions = default_8MB.csv
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
custom_meshtastic_hw_model = 113
|
|
||||||
custom_meshtastic_hw_model_slug = HELTEC_WIRELESS_TRACKER_V2
|
|
||||||
custom_meshtastic_architecture = esp32s3
|
|
||||||
custom_meshtastic_display_name = Heltec Wireless Tracker V2
|
|
||||||
custom_meshtastic_actively_supported = true
|
|
||||||
|
|
||||||
build_flags =
|
build_flags =
|
||||||
${esp32s3_base.build_flags}
|
${esp32s3_base.build_flags}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ lib_deps =
|
|||||||
# renovate: datasource=custom.pio depName=LovyanGFX packageName=lovyan03/library/LovyanGFX
|
# renovate: datasource=custom.pio depName=LovyanGFX packageName=lovyan03/library/LovyanGFX
|
||||||
lovyan03/LovyanGFX@1.2.7
|
lovyan03/LovyanGFX@1.2.7
|
||||||
# renovate: datasource=git-refs depName=libch341-spi-userspace packageName=https://github.com/pine64/libch341-spi-userspace gitBranch=main
|
# renovate: datasource=git-refs depName=libch341-spi-userspace packageName=https://github.com/pine64/libch341-spi-userspace gitBranch=main
|
||||||
https://github.com/pine64/libch341-spi-userspace/archive/23c42319a69cffcb65868e3c72e6bed83974a393.zip
|
https://github.com/pine64/libch341-spi-userspace/archive/af9bc27c9c30fa90772279925b7c5913dff789b4.zip
|
||||||
# renovate: datasource=custom.pio depName=adafruit/Adafruit seesaw Library packageName=adafruit/library/Adafruit seesaw Library
|
# renovate: datasource=custom.pio depName=adafruit/Adafruit seesaw Library packageName=adafruit/library/Adafruit seesaw Library
|
||||||
adafruit/Adafruit seesaw Library@1.7.9
|
adafruit/Adafruit seesaw Library@1.7.9
|
||||||
# renovate: datasource=git-refs depName=RAK12034-BMX160 packageName=https://github.com/RAKWireless/RAK12034-BMX160 gitBranch=main
|
# renovate: datasource=git-refs depName=RAK12034-BMX160 packageName=https://github.com/RAKWireless/RAK12034-BMX160 gitBranch=main
|
||||||
|
|||||||
@@ -59,11 +59,4 @@ void variant_shutdown()
|
|||||||
NRF_GPIO->DIRCLR = (1 << pin);
|
NRF_GPIO->DIRCLR = (1 << pin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nrf_gpio_cfg_input(PIN_BUTTON1, NRF_GPIO_PIN_PULLUP); // Configure the pin to be woken up as an input
|
|
||||||
nrf_gpio_pin_sense_t sense = NRF_GPIO_PIN_SENSE_LOW;
|
|
||||||
nrf_gpio_cfg_sense_set(PIN_BUTTON1, sense);
|
|
||||||
|
|
||||||
nrf_gpio_cfg_input(PIN_BUTTON2, NRF_GPIO_PIN_PULLUP);
|
|
||||||
nrf_gpio_pin_sense_t sense1 = NRF_GPIO_PIN_SENSE_LOW;
|
|
||||||
nrf_gpio_cfg_sense_set(PIN_BUTTON2, sense1);
|
|
||||||
}
|
}
|
||||||
@@ -49,21 +49,3 @@ void initVariant()
|
|||||||
pinMode(Battery_LED_4, OUTPUT);
|
pinMode(Battery_LED_4, OUTPUT);
|
||||||
ledOff(Battery_LED_4);
|
ledOff(Battery_LED_4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// called from main-nrf52.cpp during the cpuDeepSleep() function
|
|
||||||
void variant_shutdown()
|
|
||||||
{
|
|
||||||
for (int pin = 0; pin < 48; pin++) {
|
|
||||||
if (pin == PIN_GPS_EN || pin == PIN_BUTTON1) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
pinMode(pin, OUTPUT);
|
|
||||||
digitalWrite(pin, LOW);
|
|
||||||
if (pin >= 32) {
|
|
||||||
NRF_P1->DIRCLR = (1 << (pin - 32));
|
|
||||||
} else {
|
|
||||||
NRF_GPIO->DIRCLR = (1 << pin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
digitalWrite(PIN_GPS_EN, HIGH);
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -36,10 +36,3 @@ void initVariant()
|
|||||||
pinMode(PIN_3V3_EN, OUTPUT);
|
pinMode(PIN_3V3_EN, OUTPUT);
|
||||||
digitalWrite(PIN_3V3_EN, HIGH);
|
digitalWrite(PIN_3V3_EN, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void variant_shutdown()
|
|
||||||
{
|
|
||||||
nrf_gpio_cfg_input(BUTTON_PIN, NRF_GPIO_PIN_PULLUP); // Enable internal pull-up on the button pin
|
|
||||||
nrf_gpio_pin_sense_t sense = NRF_GPIO_PIN_SENSE_LOW; // Configure SENSE signal on low edge
|
|
||||||
nrf_gpio_cfg_sense_set(BUTTON_PIN, sense); // Apply SENSE to wake up the device from the deep sleep
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user