mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-15 07:12:34 +00:00
Compare commits
10 Commits
multi-mess
...
rak6421
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec62f902ee | ||
|
|
6c969ac325 | ||
|
|
e77629a154 | ||
|
|
313d6ccbf8 | ||
|
|
bcd9caed6d | ||
|
|
83902fe406 | ||
|
|
b7d9d6b29a | ||
|
|
0a03effcab | ||
|
|
b1a22e32d6 | ||
|
|
b627d305d0 |
@@ -9,13 +9,4 @@ Lora:
|
|||||||
DIO3_TCXO_VOLTAGE: true
|
DIO3_TCXO_VOLTAGE: true
|
||||||
DIO2_AS_RF_SWITCH: true
|
DIO2_AS_RF_SWITCH: true
|
||||||
spidev: spidev0.0
|
spidev: spidev0.0
|
||||||
# CS: 8
|
# CS: 8
|
||||||
|
|
||||||
|
|
||||||
### RAK13300in Slot 2 pins
|
|
||||||
# IRQ: 18 #IO6
|
|
||||||
# Reset: 24 # IO4
|
|
||||||
# Busy: 19 # IO5
|
|
||||||
# # Ant_sw: 23 # IO3
|
|
||||||
# spidev: spidev0.1
|
|
||||||
# # CS: 7
|
|
||||||
8
bin/config.d/lora-RAK6421-slot2.yaml
Normal file
8
bin/config.d/lora-RAK6421-slot2.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Lora:
|
||||||
|
### RAK13300in Slot 2 pins
|
||||||
|
IRQ: 18 #IO6
|
||||||
|
Reset: 24 # IO4
|
||||||
|
Busy: 19 # IO5
|
||||||
|
# Ant_sw: 23 # IO3
|
||||||
|
spidev: spidev0.1
|
||||||
|
# CS: 7
|
||||||
@@ -667,15 +667,19 @@ static LGFX *tft = nullptr;
|
|||||||
static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h
|
static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h
|
||||||
#elif ARCH_PORTDUINO
|
#elif ARCH_PORTDUINO
|
||||||
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
|
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
|
||||||
|
#if defined(LGFX_SDL)
|
||||||
|
#include <lgfx/v1/platforms/sdl/Panel_sdl.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
class LGFX : public lgfx::LGFX_Device
|
class LGFX : public lgfx::LGFX_Device
|
||||||
{
|
{
|
||||||
lgfx::Panel_Device *_panel_instance;
|
|
||||||
lgfx::Bus_SPI _bus_instance;
|
lgfx::Bus_SPI _bus_instance;
|
||||||
|
|
||||||
lgfx::ITouch *_touch_instance;
|
lgfx::ITouch *_touch_instance;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
lgfx::Panel_Device *_panel_instance;
|
||||||
|
|
||||||
LGFX(void)
|
LGFX(void)
|
||||||
{
|
{
|
||||||
if (settingsMap[displayPanel] == st7789)
|
if (settingsMap[displayPanel] == st7789)
|
||||||
@@ -694,6 +698,11 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_panel_instance = new lgfx::Panel_ILI9488;
|
_panel_instance = new lgfx::Panel_ILI9488;
|
||||||
else if (settingsMap[displayPanel] == hx8357d)
|
else if (settingsMap[displayPanel] == hx8357d)
|
||||||
_panel_instance = new lgfx::Panel_HX8357D;
|
_panel_instance = new lgfx::Panel_HX8357D;
|
||||||
|
#if defined(LGFX_SDL)
|
||||||
|
else if (settingsMap[displayPanel] == x11) {
|
||||||
|
_panel_instance = new lgfx::Panel_sdl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else {
|
else {
|
||||||
_panel_instance = new lgfx::Panel_NULL;
|
_panel_instance = new lgfx::Panel_NULL;
|
||||||
LOG_ERROR("Unknown display panel configured!");
|
LOG_ERROR("Unknown display panel configured!");
|
||||||
@@ -754,7 +763,13 @@ class LGFX : public lgfx::LGFX_Device
|
|||||||
_touch_instance->config(touch_cfg);
|
_touch_instance->config(touch_cfg);
|
||||||
_panel_instance->setTouch(_touch_instance);
|
_panel_instance->setTouch(_touch_instance);
|
||||||
}
|
}
|
||||||
|
#if defined(LGFX_SDL)
|
||||||
|
if (settingsMap[displayPanel] == x11) {
|
||||||
|
lgfx::Panel_sdl *sdl_panel_ = (lgfx::Panel_sdl *)_panel_instance;
|
||||||
|
sdl_panel_->setup();
|
||||||
|
sdl_panel_->addKeyCodeMapping(SDLK_RETURN, SDL_SCANCODE_KP_ENTER);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
setPanel(_panel_instance); // Sets the panel to use.
|
setPanel(_panel_instance); // Sets the panel to use.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1060,6 +1075,49 @@ void TFTDisplay::display(bool fromBlank)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TFTDisplay::sdlLoop()
|
||||||
|
{
|
||||||
|
#if defined(LGFX_SDL)
|
||||||
|
static int lastPressed = 0;
|
||||||
|
static int shuttingDown = false;
|
||||||
|
if (settingsMap[displayPanel] == x11) {
|
||||||
|
lgfx::Panel_sdl *sdl_panel_ = (lgfx::Panel_sdl *)tft->_panel_instance;
|
||||||
|
if (sdl_panel_->loop() && !shuttingDown) {
|
||||||
|
LOG_WARN("Window Closed!");
|
||||||
|
InputEvent event = {.inputEvent = (input_broker_event)INPUT_BROKER_SHUTDOWN, .kbchar = 0, .touchX = 0, .touchY = 0};
|
||||||
|
inputBroker->injectInputEvent(&event);
|
||||||
|
}
|
||||||
|
|
||||||
|
// debounce
|
||||||
|
if (lastPressed != 0 && !lgfx::v1::gpio_in(lastPressed))
|
||||||
|
return;
|
||||||
|
if (!lgfx::v1::gpio_in(37)) {
|
||||||
|
lastPressed = 37;
|
||||||
|
InputEvent event = {.inputEvent = (input_broker_event)INPUT_BROKER_RIGHT, .kbchar = 0, .touchX = 0, .touchY = 0};
|
||||||
|
inputBroker->injectInputEvent(&event);
|
||||||
|
} else if (!lgfx::v1::gpio_in(36)) {
|
||||||
|
lastPressed = 36;
|
||||||
|
InputEvent event = {.inputEvent = (input_broker_event)INPUT_BROKER_UP, .kbchar = 0, .touchX = 0, .touchY = 0};
|
||||||
|
inputBroker->injectInputEvent(&event);
|
||||||
|
} else if (!lgfx::v1::gpio_in(38)) {
|
||||||
|
lastPressed = 38;
|
||||||
|
InputEvent event = {.inputEvent = (input_broker_event)INPUT_BROKER_DOWN, .kbchar = 0, .touchX = 0, .touchY = 0};
|
||||||
|
inputBroker->injectInputEvent(&event);
|
||||||
|
} else if (!lgfx::v1::gpio_in(39)) {
|
||||||
|
lastPressed = 39;
|
||||||
|
InputEvent event = {.inputEvent = (input_broker_event)INPUT_BROKER_LEFT, .kbchar = 0, .touchX = 0, .touchY = 0};
|
||||||
|
inputBroker->injectInputEvent(&event);
|
||||||
|
} else if (!lgfx::v1::gpio_in(SDL_SCANCODE_KP_ENTER)) {
|
||||||
|
lastPressed = SDL_SCANCODE_KP_ENTER;
|
||||||
|
InputEvent event = {.inputEvent = (input_broker_event)INPUT_BROKER_SELECT, .kbchar = 0, .touchX = 0, .touchY = 0};
|
||||||
|
inputBroker->injectInputEvent(&event);
|
||||||
|
} else {
|
||||||
|
lastPressed = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Send a command to the display (low level function)
|
// Send a command to the display (low level function)
|
||||||
void TFTDisplay::sendCommand(uint8_t com)
|
void TFTDisplay::sendCommand(uint8_t com)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class TFTDisplay : public OLEDDisplay
|
|||||||
// Write the buffer to the display memory
|
// Write the buffer to the display memory
|
||||||
virtual void display() override { display(false); };
|
virtual void display() override { display(false); };
|
||||||
virtual void display(bool fromBlank);
|
virtual void display(bool fromBlank);
|
||||||
|
void sdlLoop();
|
||||||
|
|
||||||
// Turn the display upside down
|
// Turn the display upside down
|
||||||
virtual void flipScreenVertically();
|
virtual void flipScreenVertically();
|
||||||
|
|||||||
@@ -1562,7 +1562,13 @@ void loop()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
service->loop();
|
service->loop();
|
||||||
|
#if defined(LGFX_SDL)
|
||||||
|
if (screen) {
|
||||||
|
auto dispdev = screen->getDisplayDevice();
|
||||||
|
if (dispdev)
|
||||||
|
static_cast<TFTDisplay *>(dispdev)->sdlLoop();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
long delayMsec = mainController.runOrDelay();
|
long delayMsec = mainController.runOrDelay();
|
||||||
|
|
||||||
// We want to sleep as long as possible here - because it saves power
|
// We want to sleep as long as possible here - because it saves power
|
||||||
|
|||||||
@@ -225,7 +225,11 @@ NodeDB::NodeDB()
|
|||||||
memcpy(myNodeInfo.device_id.bytes + sizeof(device_id_start), &device_id_end, sizeof(device_id_end));
|
memcpy(myNodeInfo.device_id.bytes + sizeof(device_id_start), &device_id_end, sizeof(device_id_end));
|
||||||
myNodeInfo.device_id.size = 16;
|
myNodeInfo.device_id.size = 16;
|
||||||
// Uncomment below to print the device id
|
// Uncomment below to print the device id
|
||||||
|
#elif ARCH_PORTDUINO
|
||||||
|
if (portduino_config.has_device_id) {
|
||||||
|
memcpy(myNodeInfo.device_id.bytes, portduino_config.device_id, 16);
|
||||||
|
myNodeInfo.device_id.size = 16;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
// FIXME - implement for other platforms
|
// FIXME - implement for other platforms
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -264,6 +264,51 @@ void portduinoSetup()
|
|||||||
} else {
|
} else {
|
||||||
std::cout << "autoconf: Could not locate Pi HAT+ at /proc/device-tree/hat/product" << std::endl;
|
std::cout << "autoconf: Could not locate Pi HAT+ at /proc/device-tree/hat/product" << std::endl;
|
||||||
}
|
}
|
||||||
|
// attempt to load autoconf data from an EEPROM on 0x50
|
||||||
|
// RAK6421S1:aabbcc123456:5ba85807d92138b7519cfb60460573af
|
||||||
|
// <model string>:mac address :<16 random unique bytes in hexidecimal>
|
||||||
|
try {
|
||||||
|
char *mac_start = nullptr;
|
||||||
|
char *devID_start = nullptr;
|
||||||
|
Wire.begin();
|
||||||
|
Wire.beginTransmission(0x50);
|
||||||
|
Wire.write(0x0);
|
||||||
|
Wire.write(0x0);
|
||||||
|
Wire.endTransmission();
|
||||||
|
Wire.requestFrom((uint8_t)0x50, (uint8_t)75);
|
||||||
|
uint8_t i = 0;
|
||||||
|
delay(100);
|
||||||
|
while (Wire.available() && i < sizeof(autoconf_product)) {
|
||||||
|
autoconf_product[i] = Wire.read();
|
||||||
|
if (autoconf_product[i] == 0xff) {
|
||||||
|
autoconf_product[i] = 0x0;
|
||||||
|
break;
|
||||||
|
} else if (autoconf_product[i] == ':') {
|
||||||
|
autoconf_product[i] = 0x0;
|
||||||
|
if (mac_start == nullptr) {
|
||||||
|
mac_start = autoconf_product + i + 1;
|
||||||
|
} else if (devID_start == nullptr) {
|
||||||
|
devID_start = autoconf_product + i + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
std::cout << "autoconf: Found eeprom data " << autoconf_product << std::endl;
|
||||||
|
std::cout << "autoconf: Found mac data " << mac_start << std::endl;
|
||||||
|
std::cout << "autoconf: Found deviceid data " << devID_start << std::endl;
|
||||||
|
if (strlen(mac_start) == 12)
|
||||||
|
settingsStrings[mac_address] = std::string(mac_start);
|
||||||
|
if (strlen(devID_start) == 32) {
|
||||||
|
std::string devID_str(devID_start);
|
||||||
|
for (int j = 0; j < 16; j++) {
|
||||||
|
portduino_config.device_id[j] = std::stoi(devID_str.substr(j*2, 2), nullptr, 16);
|
||||||
|
}
|
||||||
|
portduino_config.has_device_id = true;
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
std::cout << "autoconf: Could not locate EEPROM" << std::endl;
|
||||||
|
}
|
||||||
// Load the config file based on the product string
|
// Load the config file based on the product string
|
||||||
if (strlen(autoconf_product) > 0) {
|
if (strlen(autoconf_product) > 0) {
|
||||||
// From configProducts map in PortduinoGlue.h
|
// From configProducts map in PortduinoGlue.h
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
// Product strings for auto-configuration
|
// Product strings for auto-configuration
|
||||||
// {"PRODUCT_STRING", "CONFIG.YAML"}
|
// {"PRODUCT_STRING", "CONFIG.YAML"}
|
||||||
// YAML paths are relative to `meshtastic/available.d`
|
// YAML paths are relative to `meshtastic/available.d`
|
||||||
inline const std::unordered_map<std::string, std::string> configProducts = {{"MESHTOAD", "lora-usb-meshtoad-e22.yaml"},
|
inline const std::unordered_map<std::string, std::string> configProducts = {
|
||||||
{"MESHSTICK", "lora-meshstick-1262.yaml"},
|
{"MESHTOAD", "lora-usb-meshtoad-e22.yaml"}, {"MESHSTICK", "lora-meshstick-1262.yaml"},
|
||||||
{"MESHADV-PI", "lora-MeshAdv-900M30S.yaml"},
|
{"MESHADV-PI", "lora-MeshAdv-900M30S.yaml"}, {"MeshAdv Mini", "lora-MeshAdv-Mini-900M22S.yaml"},
|
||||||
{"MeshAdv Mini", "lora-MeshAdv-Mini-900M22S.yaml"},
|
{"POWERPI", "lora-MeshAdv-900M30S.yaml"}, {"RAK6421S1", "lora-RAK6421-slot1.yaml"},
|
||||||
{"POWERPI", "lora-MeshAdv-900M30S.yaml"}};
|
{"RAK6421S2", "lora-RAK6421-slot2.yaml"}};
|
||||||
|
|
||||||
enum configNames {
|
enum configNames {
|
||||||
default_gpiochip,
|
default_gpiochip,
|
||||||
@@ -135,4 +135,6 @@ extern struct portduino_config_struct {
|
|||||||
uint32_t rfswitch_dio_pins[5] = {RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
uint32_t rfswitch_dio_pins[5] = {RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
||||||
Module::RfSwitchMode_t rfswitch_table[8];
|
Module::RfSwitchMode_t rfswitch_table[8];
|
||||||
bool force_simradio = false;
|
bool force_simradio = false;
|
||||||
|
bool has_device_id = false;
|
||||||
|
uint8_t device_id[16] = {0};
|
||||||
} portduino_config;
|
} portduino_config;
|
||||||
@@ -25,7 +25,6 @@ build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunctio
|
|||||||
-D USE_X11=1
|
-D USE_X11=1
|
||||||
-D HAS_TFT=1
|
-D HAS_TFT=1
|
||||||
-D HAS_SCREEN=1
|
-D HAS_SCREEN=1
|
||||||
|
|
||||||
-D LV_CACHE_DEF_SIZE=6291456
|
-D LV_CACHE_DEF_SIZE=6291456
|
||||||
-D LV_BUILD_TEST=0
|
-D LV_BUILD_TEST=0
|
||||||
-D LV_USE_LIBINPUT=1
|
-D LV_USE_LIBINPUT=1
|
||||||
@@ -41,6 +40,25 @@ build_flags = ${native_base.build_flags} -Os -lX11 -linput -lxkbcommon -ffunctio
|
|||||||
build_src_filter =
|
build_src_filter =
|
||||||
${native_base.build_src_filter}
|
${native_base.build_src_filter}
|
||||||
|
|
||||||
|
[env:native-sdl]
|
||||||
|
extends = native_base
|
||||||
|
build_type = release
|
||||||
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
${networking_base.lib_deps}
|
||||||
|
${radiolib_base.lib_deps}
|
||||||
|
${environmental_base.lib_deps}
|
||||||
|
# renovate: datasource=custom.pio depName=rweather/Crypto packageName=rweather/library/Crypto
|
||||||
|
rweather/Crypto@0.4.0
|
||||||
|
# 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/af9bc27c9c30fa90772279925b7c5913dff789b4.zip
|
||||||
|
# renovate: datasource=custom.pio depName=adafruit/Adafruit seesaw Library packageName=adafruit/library/Adafruit seesaw Library
|
||||||
|
adafruit/Adafruit seesaw Library@1.7.9
|
||||||
|
https://github.com/jp-bennett/LovyanGFX/archive/7458f84a126c1f8fdc7b038074f71be903f6e4c0.zip
|
||||||
|
build_flags = ${native_base.build_flags}
|
||||||
|
!pkg-config --cflags --libs sdl2 --silence-errors || :
|
||||||
|
-D LGFX_SDL=1
|
||||||
|
|
||||||
[env:native-fb]
|
[env:native-fb]
|
||||||
extends = native_base
|
extends = native_base
|
||||||
build_type = release
|
build_type = release
|
||||||
|
|||||||
Reference in New Issue
Block a user