mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-07 10:27:43 +00:00
Compare commits
1 Commits
b-kind-don
...
indicator-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f379b8f6d |
238
.github/workflows/pr_tests.yml
vendored
238
.github/workflows/pr_tests.yml
vendored
@@ -1,238 +0,0 @@
|
|||||||
name: Tests
|
|
||||||
|
|
||||||
# DISABLED: Changed from automatic PR triggers to manual only
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
reason:
|
|
||||||
description: "Reason for manual test run"
|
|
||||||
required: false
|
|
||||||
default: "Manual test execution"
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: tests-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
checks: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
native-tests:
|
|
||||||
name: "🧪 Native Tests"
|
|
||||||
if: github.repository == 'meshtastic/firmware'
|
|
||||||
uses: ./.github/workflows/test_native.yml
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
checks: write
|
|
||||||
|
|
||||||
test-summary:
|
|
||||||
name: "📊 Test Results"
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [native-tests]
|
|
||||||
if: always()
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
checks: write
|
|
||||||
pull-requests: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v5
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
|
|
||||||
- name: Get release version string
|
|
||||||
run: echo "long=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT
|
|
||||||
id: version
|
|
||||||
|
|
||||||
- name: Download test artifacts
|
|
||||||
if: needs.native-tests.result != 'skipped'
|
|
||||||
uses: actions/download-artifact@v5
|
|
||||||
with:
|
|
||||||
name: platformio-test-report-${{ steps.version.outputs.long }}.zip
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Parse test results and create detailed summary
|
|
||||||
id: test-results
|
|
||||||
run: |
|
|
||||||
echo "## 🧪 Test Results Summary" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
# Check overall job status first
|
|
||||||
if [[ "${{ needs.native-tests.result }}" == "success" ]]; then
|
|
||||||
echo "✅ **Overall Status**: PASSED" >> $GITHUB_STEP_SUMMARY
|
|
||||||
elif [[ "${{ needs.native-tests.result }}" == "failure" ]]; then
|
|
||||||
echo "❌ **Overall Status**: FAILED" >> $GITHUB_STEP_SUMMARY
|
|
||||||
elif [[ "${{ needs.native-tests.result }}" == "cancelled" ]]; then
|
|
||||||
echo "⏸️ **Overall Status**: CANCELLED" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "Tests were cancelled before completion." >> $GITHUB_STEP_SUMMARY
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "⚠️ **Overall Status**: SKIPPED" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "Tests were skipped." >> $GITHUB_STEP_SUMMARY
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
# Parse detailed test results if available
|
|
||||||
if [ -f "testreport.xml" ]; then
|
|
||||||
echo "### 🔍 Individual Test Results" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
python3 << 'EOF'
|
|
||||||
import xml.etree.ElementTree as ET
|
|
||||||
import os
|
|
||||||
|
|
||||||
try:
|
|
||||||
tree = ET.parse('testreport.xml')
|
|
||||||
root = tree.getroot()
|
|
||||||
|
|
||||||
total_tests = 0
|
|
||||||
passed_tests = 0
|
|
||||||
failed_tests = 0
|
|
||||||
skipped_tests = 0
|
|
||||||
|
|
||||||
# Parse testsuite elements
|
|
||||||
for testsuite in root.findall('.//testsuite'):
|
|
||||||
suite_name = testsuite.get('name', 'Unknown')
|
|
||||||
suite_tests = int(testsuite.get('tests', '0'))
|
|
||||||
suite_failures = int(testsuite.get('failures', '0'))
|
|
||||||
suite_errors = int(testsuite.get('errors', '0'))
|
|
||||||
suite_skipped = int(testsuite.get('skipped', '0'))
|
|
||||||
|
|
||||||
total_tests += suite_tests
|
|
||||||
failed_tests += suite_failures + suite_errors
|
|
||||||
skipped_tests += suite_skipped
|
|
||||||
passed_tests += suite_tests - suite_failures - suite_errors - suite_skipped
|
|
||||||
|
|
||||||
if suite_tests > 0:
|
|
||||||
status = "✅" if (suite_failures + suite_errors) == 0 else "❌"
|
|
||||||
print(f"**{status} Test Suite: {suite_name}**")
|
|
||||||
print(f"- Total: {suite_tests}")
|
|
||||||
print(f"- Passed: ✅ {suite_tests - suite_failures - suite_errors - suite_skipped}")
|
|
||||||
print(f"- Failed: ❌ {suite_failures + suite_errors}")
|
|
||||||
if suite_skipped > 0:
|
|
||||||
print(f"- Skipped: ⏭️ {suite_skipped}")
|
|
||||||
print("")
|
|
||||||
|
|
||||||
# Show individual test results for failed suites
|
|
||||||
if suite_failures + suite_errors > 0:
|
|
||||||
print("**Failed Tests:**")
|
|
||||||
for testcase in testsuite.findall('testcase'):
|
|
||||||
test_name = testcase.get('name', 'Unknown')
|
|
||||||
failure = testcase.find('failure')
|
|
||||||
error = testcase.find('error')
|
|
||||||
|
|
||||||
if failure is not None:
|
|
||||||
msg = failure.get('message', 'Unknown error')[:100]
|
|
||||||
print(f"- ❌ `{test_name}`: {msg}")
|
|
||||||
elif error is not None:
|
|
||||||
msg = error.get('message', 'Unknown error')[:100]
|
|
||||||
print(f"- ❌ `{test_name}`: ERROR - {msg}")
|
|
||||||
print("")
|
|
||||||
else:
|
|
||||||
# Show passed tests for successful suites
|
|
||||||
passed_count = 0
|
|
||||||
for testcase in testsuite.findall('testcase'):
|
|
||||||
if testcase.find('failure') is None and testcase.find('error') is None:
|
|
||||||
if passed_count < 5: # Limit to first 5 to avoid spam
|
|
||||||
test_name = testcase.get('name', 'Unknown')
|
|
||||||
print(f"- ✅ `{test_name}`: PASSED")
|
|
||||||
passed_count += 1
|
|
||||||
if passed_count > 5:
|
|
||||||
print(f"- ... and {passed_count - 5} more tests passed")
|
|
||||||
print("")
|
|
||||||
|
|
||||||
# Summary statistics
|
|
||||||
print("### 📊 Test Statistics")
|
|
||||||
print(f"- **Total Tests**: {total_tests}")
|
|
||||||
print(f"- **Passed**: ✅ {passed_tests}")
|
|
||||||
print(f"- **Failed**: ❌ {failed_tests}")
|
|
||||||
if skipped_tests > 0:
|
|
||||||
print(f"- **Skipped**: ⏭️ {skipped_tests}")
|
|
||||||
|
|
||||||
if failed_tests > 0:
|
|
||||||
print(f"\n❌ **{failed_tests} tests failed out of {total_tests} total**")
|
|
||||||
else:
|
|
||||||
print(f"\n✅ **All {total_tests} tests passed!**")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"❌ Error parsing test results: {e}")
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
echo "⚠️ **No detailed test report available**" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "Test artifacts may not have been generated properly." >> $GITHUB_STEP_SUMMARY
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "---" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "View detailed logs in the [Actions tab](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
||||||
- name: Comment test results on PR
|
|
||||||
if: github.event_name == 'pull_request' && needs.native-tests.result != 'skipped'
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const fs = require('fs');
|
|
||||||
|
|
||||||
// Read the step summary to use as PR comment
|
|
||||||
let testSummary = "## 🧪 Test Results Summary\n\n";
|
|
||||||
|
|
||||||
if ("${{ needs.native-tests.result }}" === "success") {
|
|
||||||
testSummary += "✅ **All tests passed!**\n\n";
|
|
||||||
} else if ("${{ needs.native-tests.result }}" === "failure") {
|
|
||||||
testSummary += "❌ **Some tests failed.**\n\n";
|
|
||||||
} else {
|
|
||||||
testSummary += "⚠️ **Tests did not complete normally.**\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
testSummary += `View detailed results: [Actions Run](${context.payload.repository.html_url}/actions/runs/${context.runId})\n\n`;
|
|
||||||
testSummary += "---\n";
|
|
||||||
testSummary += "*This comment will be automatically updated when new commits are pushed.*";
|
|
||||||
|
|
||||||
// Find existing comment
|
|
||||||
const comments = await github.rest.issues.listComments({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
issue_number: context.issue.number
|
|
||||||
});
|
|
||||||
|
|
||||||
const botComment = comments.data.find(comment =>
|
|
||||||
comment.user.type === 'Bot' &&
|
|
||||||
comment.body.includes('🧪 Test Results Summary')
|
|
||||||
);
|
|
||||||
|
|
||||||
if (botComment) {
|
|
||||||
// Update existing comment
|
|
||||||
await github.rest.issues.updateComment({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
comment_id: botComment.id,
|
|
||||||
body: testSummary
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
// Create new comment
|
|
||||||
await github.rest.issues.createComment({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
body: testSummary
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Set overall status
|
|
||||||
run: |
|
|
||||||
if [[ "${{ needs.native-tests.result }}" == "success" ]]; then
|
|
||||||
echo "All tests passed! ✅"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "Some tests failed! ❌"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -9,9 +9,9 @@ plugins:
|
|||||||
lint:
|
lint:
|
||||||
enabled:
|
enabled:
|
||||||
- checkov@3.2.461
|
- checkov@3.2.461
|
||||||
- renovate@41.74.0
|
- renovate@41.71.1
|
||||||
- prettier@3.6.2
|
- prettier@3.6.2
|
||||||
- trufflehog@3.90.5
|
- trufflehog@3.90.4
|
||||||
- yamllint@1.37.1
|
- yamllint@1.37.1
|
||||||
- bandit@1.8.6
|
- bandit@1.8.6
|
||||||
- trivy@0.64.1
|
- trivy@0.64.1
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ RUN apt-get update && apt-get --no-install-recommends -y install \
|
|||||||
|
|
||||||
# Fetch compiled binary from the builder
|
# Fetch compiled binary from the builder
|
||||||
COPY --from=builder /tmp/firmware/release/meshtasticd /usr/bin/
|
COPY --from=builder /tmp/firmware/release/meshtasticd /usr/bin/
|
||||||
COPY --from=builder /tmp/web /usr/share/meshtasticd/web/
|
COPY --from=builder /tmp/web /usr/share/meshtasticd/
|
||||||
# Copy config templates
|
# Copy config templates
|
||||||
COPY ./bin/config.d /etc/meshtasticd/available.d
|
COPY ./bin/config.d /etc/meshtasticd/available.d
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
[portduino_base]
|
[portduino_base]
|
||||||
platform =
|
platform =
|
||||||
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop
|
# renovate: datasource=git-refs depName=platform-native packageName=https://github.com/meshtastic/platform-native gitBranch=develop
|
||||||
https://github.com/meshtastic/platform-native/archive/37d986499ce24511952d7146db72d667c6bdaff7.zip
|
https://github.com/meshtastic/platform-native/archive/6cb7a455b440dd0738e8ed74a18136ed5cf7ea63.zip
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
Lora:
|
|
||||||
### RAK13300in Slot 2 pins
|
|
||||||
IRQ: 18 #IO6
|
|
||||||
Reset: 24 # IO4
|
|
||||||
Busy: 19 # IO5
|
|
||||||
# Ant_sw: 23 # IO3
|
|
||||||
spidev: spidev0.1
|
|
||||||
# CS: 7
|
|
||||||
@@ -9,4 +9,13 @@ 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
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"arduino": {
|
|
||||||
"ldscript": "nrf52840_s140_v6.ld"
|
|
||||||
},
|
|
||||||
"core": "nRF5",
|
|
||||||
"cpu": "cortex-m4",
|
|
||||||
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
|
|
||||||
"f_cpu": "64000000L",
|
|
||||||
"hwids": [
|
|
||||||
["0x239A", "0x8029"],
|
|
||||||
["0x239A", "0x0029"],
|
|
||||||
["0x239A", "0x002A"],
|
|
||||||
["0x239A", "0x802A"]
|
|
||||||
],
|
|
||||||
"usb_product": "MeshTiny",
|
|
||||||
"mcu": "nrf52840",
|
|
||||||
"variant": "meshtiny",
|
|
||||||
"bsp": {
|
|
||||||
"name": "adafruit"
|
|
||||||
},
|
|
||||||
"softdevice": {
|
|
||||||
"sd_flags": "-DS140",
|
|
||||||
"sd_name": "s140",
|
|
||||||
"sd_version": "6.1.1",
|
|
||||||
"sd_fwid": "0x00B6"
|
|
||||||
},
|
|
||||||
"bootloader": {
|
|
||||||
"settings_addr": "0xFF000"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"connectivity": ["bluetooth"],
|
|
||||||
"debug": {
|
|
||||||
"jlink_device": "nRF52840_xxAA",
|
|
||||||
"svd_path": "nrf52840.svd",
|
|
||||||
"openocd_target": "nrf52840-mdk-rs"
|
|
||||||
},
|
|
||||||
"frameworks": ["arduino", "freertos"],
|
|
||||||
"name": "MeshTiny",
|
|
||||||
"upload": {
|
|
||||||
"maximum_ram_size": 248832,
|
|
||||||
"maximum_size": 815104,
|
|
||||||
"speed": 115200,
|
|
||||||
"protocol": "nrfutil",
|
|
||||||
"protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"],
|
|
||||||
"use_1200bps_touch": true,
|
|
||||||
"require_upload_port": true,
|
|
||||||
"wait_for_upload_port": true
|
|
||||||
},
|
|
||||||
"url": "https://github.com/meshtastic/firmware",
|
|
||||||
"vendor": "MTools Tec"
|
|
||||||
}
|
|
||||||
@@ -60,7 +60,7 @@ monitor_speed = 115200
|
|||||||
monitor_filters = direct
|
monitor_filters = direct
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# renovate: datasource=git-refs depName=meshtastic-esp8266-oled-ssd1306 packageName=https://github.com/meshtastic/esp8266-oled-ssd1306 gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic-esp8266-oled-ssd1306 packageName=https://github.com/meshtastic/esp8266-oled-ssd1306 gitBranch=master
|
||||||
https://github.com/meshtastic/esp8266-oled-ssd1306/archive/9573abb64dc9c94f3051348f2bf4fc5cedf03c22.zip
|
https://github.com/meshtastic/esp8266-oled-ssd1306/archive/0119501e9983bd894830b02f545c377ee08d66fe.zip
|
||||||
# renovate: datasource=git-refs depName=meshtastic-OneButton packageName=https://github.com/meshtastic/OneButton gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic-OneButton packageName=https://github.com/meshtastic/OneButton gitBranch=master
|
||||||
https://github.com/meshtastic/OneButton/archive/fa352d668c53f290cfa480a5f79ad422cd828c70.zip
|
https://github.com/meshtastic/OneButton/archive/fa352d668c53f290cfa480a5f79ad422cd828c70.zip
|
||||||
# renovate: datasource=git-refs depName=meshtastic-arduino-fsm packageName=https://github.com/meshtastic/arduino-fsm gitBranch=master
|
# renovate: datasource=git-refs depName=meshtastic-arduino-fsm packageName=https://github.com/meshtastic/arduino-fsm gitBranch=master
|
||||||
@@ -118,7 +118,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/3dc7cf3e233aaa8cc23492cca50541fc099ebfa1.zip
|
https://github.com/meshtastic/device-ui/archive/0cd108ff783539e41ef38258ba2784ab3b1bdc97.zip
|
||||||
|
|
||||||
; Common libs for environmental measurements in telemetry module
|
; Common libs for environmental measurements in telemetry module
|
||||||
[environmental_base]
|
[environmental_base]
|
||||||
|
|||||||
Submodule protobufs updated: 8985852d75...5dd723fe6f
@@ -667,19 +667,15 @@ 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)
|
||||||
@@ -698,11 +694,6 @@ 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!");
|
||||||
@@ -763,13 +754,7 @@ 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.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1075,49 +1060,6 @@ 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,7 +23,6 @@ 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,13 +1562,7 @@ 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
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
#include "mesh/NodeDB.h"
|
#include "mesh/NodeDB.h"
|
||||||
#ifdef LR11X0_DIO_AS_RF_SWITCH
|
#ifdef LR11X0_DIO_AS_RF_SWITCH
|
||||||
#include "rfswitch.h"
|
#include "rfswitch.h"
|
||||||
#elif ARCH_PORTDUINO
|
|
||||||
#include "PortduinoGlue.h"
|
|
||||||
#define rfswitch_dio_pins portduino_config.rfswitch_dio_pins
|
|
||||||
#define rfswitch_table portduino_config.rfswitch_table
|
|
||||||
#else
|
#else
|
||||||
static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
||||||
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
static const Module::RfSwitchMode_t rfswitch_table[] = {
|
||||||
@@ -18,6 +14,10 @@ static const Module::RfSwitchMode_t rfswitch_table[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ARCH_PORTDUINO
|
||||||
|
#include "PortduinoGlue.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Particular boards might define a different max power based on what their hardware can do, default to max power output if not
|
// Particular boards might define a different max power based on what their hardware can do, default to max power output if not
|
||||||
// specified (may be dangerous if using external PA and LR11x0 power config forgotten)
|
// specified (may be dangerous if using external PA and LR11x0 power config forgotten)
|
||||||
#if ARCH_PORTDUINO
|
#if ARCH_PORTDUINO
|
||||||
@@ -117,14 +117,17 @@ template <typename T> bool LR11x0Interface<T>::init()
|
|||||||
#ifdef LR11X0_DIO_AS_RF_SWITCH
|
#ifdef LR11X0_DIO_AS_RF_SWITCH
|
||||||
bool dioAsRfSwitch = true;
|
bool dioAsRfSwitch = true;
|
||||||
#elif defined(ARCH_PORTDUINO)
|
#elif defined(ARCH_PORTDUINO)
|
||||||
bool dioAsRfSwitch = portduino_config.has_rfswitch_table;
|
bool dioAsRfSwitch = false;
|
||||||
|
if (settingsMap[dio2_as_rf_switch]) {
|
||||||
|
dioAsRfSwitch = true;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
bool dioAsRfSwitch = false;
|
bool dioAsRfSwitch = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (dioAsRfSwitch) {
|
if (dioAsRfSwitch) {
|
||||||
lora.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
lora.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
|
||||||
LOG_DEBUG("Set DIO RF switch");
|
LOG_DEBUG("Set DIO RF switch", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == RADIOLIB_ERR_NONE) {
|
if (res == RADIOLIB_ERR_NONE) {
|
||||||
|
|||||||
@@ -225,11 +225,7 @@ 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
|
||||||
|
|||||||
@@ -192,6 +192,12 @@ bool PhoneAPI::handleToRadio(const uint8_t *buf, size_t bufLength)
|
|||||||
|
|
||||||
size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
||||||
{
|
{
|
||||||
|
if (!available()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// In case we send a FromRadio packet
|
||||||
|
memset(&fromRadioScratch, 0, sizeof(fromRadioScratch));
|
||||||
|
|
||||||
// Respond to heartbeat by sending queue status
|
// Respond to heartbeat by sending queue status
|
||||||
if (heartbeatReceived) {
|
if (heartbeatReceived) {
|
||||||
memset(&fromRadioScratch, 0, sizeof(fromRadioScratch));
|
memset(&fromRadioScratch, 0, sizeof(fromRadioScratch));
|
||||||
@@ -203,12 +209,6 @@ size_t PhoneAPI::getFromRadio(uint8_t *buf)
|
|||||||
return numbytes;
|
return numbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!available()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// In case we send a FromRadio packet
|
|
||||||
memset(&fromRadioScratch, 0, sizeof(fromRadioScratch));
|
|
||||||
|
|
||||||
// Advance states as needed
|
// Advance states as needed
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case STATE_SEND_NOTHING:
|
case STATE_SEND_NOTHING:
|
||||||
|
|||||||
@@ -523,10 +523,8 @@ meshtastic_Routing_Error perhapsEncode(meshtastic_MeshPacket *p)
|
|||||||
// is not in the local nodedb
|
// is not in the local nodedb
|
||||||
// First, only PKC encrypt packets we are originating
|
// First, only PKC encrypt packets we are originating
|
||||||
if (isFromUs(p) &&
|
if (isFromUs(p) &&
|
||||||
#if ARCH_PORTDUINO
|
// Don't use PKC with simulator
|
||||||
// Sim radio via the cli flag skips PKC
|
radioType != SIM_RADIO &&
|
||||||
!portduino_config.force_simradio &&
|
|
||||||
#endif
|
|
||||||
// Don't use PKC with Ham mode
|
// Don't use PKC with Ham mode
|
||||||
!owner.is_licensed &&
|
!owner.is_licensed &&
|
||||||
// Don't use PKC if it's not explicitly requested and a non-primary channel is requested
|
// Don't use PKC if it's not explicitly requested and a non-primary channel is requested
|
||||||
|
|||||||
@@ -207,10 +207,10 @@ typedef enum _meshtastic_Config_DisplayConfig_OledType {
|
|||||||
meshtastic_Config_DisplayConfig_OledType_OLED_SSD1306 = 1,
|
meshtastic_Config_DisplayConfig_OledType_OLED_SSD1306 = 1,
|
||||||
/* Default / Autodetect */
|
/* Default / Autodetect */
|
||||||
meshtastic_Config_DisplayConfig_OledType_OLED_SH1106 = 2,
|
meshtastic_Config_DisplayConfig_OledType_OLED_SH1106 = 2,
|
||||||
/* Can not be auto detected but set by proto. Used for 128x64 screens */
|
|
||||||
meshtastic_Config_DisplayConfig_OledType_OLED_SH1107 = 3,
|
|
||||||
/* Can not be auto detected but set by proto. Used for 128x128 screens */
|
/* Can not be auto detected but set by proto. Used for 128x128 screens */
|
||||||
meshtastic_Config_DisplayConfig_OledType_OLED_SH1107_128_128 = 4
|
meshtastic_Config_DisplayConfig_OledType_OLED_SH1107 = 3,
|
||||||
|
/* Can not be auto detected but set by proto. Used for 128x64 screens */
|
||||||
|
meshtastic_Config_DisplayConfig_OledType_OLED_SH1107_128_64 = 4
|
||||||
} meshtastic_Config_DisplayConfig_OledType;
|
} meshtastic_Config_DisplayConfig_OledType;
|
||||||
|
|
||||||
typedef enum _meshtastic_Config_DisplayConfig_DisplayMode {
|
typedef enum _meshtastic_Config_DisplayConfig_DisplayMode {
|
||||||
@@ -682,8 +682,8 @@ extern "C" {
|
|||||||
#define _meshtastic_Config_DisplayConfig_DisplayUnits_ARRAYSIZE ((meshtastic_Config_DisplayConfig_DisplayUnits)(meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL+1))
|
#define _meshtastic_Config_DisplayConfig_DisplayUnits_ARRAYSIZE ((meshtastic_Config_DisplayConfig_DisplayUnits)(meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL+1))
|
||||||
|
|
||||||
#define _meshtastic_Config_DisplayConfig_OledType_MIN meshtastic_Config_DisplayConfig_OledType_OLED_AUTO
|
#define _meshtastic_Config_DisplayConfig_OledType_MIN meshtastic_Config_DisplayConfig_OledType_OLED_AUTO
|
||||||
#define _meshtastic_Config_DisplayConfig_OledType_MAX meshtastic_Config_DisplayConfig_OledType_OLED_SH1107_128_128
|
#define _meshtastic_Config_DisplayConfig_OledType_MAX meshtastic_Config_DisplayConfig_OledType_OLED_SH1107_128_64
|
||||||
#define _meshtastic_Config_DisplayConfig_OledType_ARRAYSIZE ((meshtastic_Config_DisplayConfig_OledType)(meshtastic_Config_DisplayConfig_OledType_OLED_SH1107_128_128+1))
|
#define _meshtastic_Config_DisplayConfig_OledType_ARRAYSIZE ((meshtastic_Config_DisplayConfig_OledType)(meshtastic_Config_DisplayConfig_OledType_OLED_SH1107_128_64+1))
|
||||||
|
|
||||||
#define _meshtastic_Config_DisplayConfig_DisplayMode_MIN meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT
|
#define _meshtastic_Config_DisplayConfig_DisplayMode_MIN meshtastic_Config_DisplayConfig_DisplayMode_DEFAULT
|
||||||
#define _meshtastic_Config_DisplayConfig_DisplayMode_MAX meshtastic_Config_DisplayConfig_DisplayMode_COLOR
|
#define _meshtastic_Config_DisplayConfig_DisplayMode_MAX meshtastic_Config_DisplayConfig_DisplayMode_COLOR
|
||||||
|
|||||||
@@ -99,9 +99,7 @@ typedef enum _meshtastic_TelemetrySensorType {
|
|||||||
/* Sensirion SFA30 Formaldehyde sensor */
|
/* Sensirion SFA30 Formaldehyde sensor */
|
||||||
meshtastic_TelemetrySensorType_SFA30 = 42,
|
meshtastic_TelemetrySensorType_SFA30 = 42,
|
||||||
/* SEN5X PM SENSORS */
|
/* SEN5X PM SENSORS */
|
||||||
meshtastic_TelemetrySensorType_SEN5X = 43,
|
meshtastic_TelemetrySensorType_SEN5X = 43
|
||||||
/* TSL2561 light sensor */
|
|
||||||
meshtastic_TelemetrySensorType_TSL2561 = 44
|
|
||||||
} meshtastic_TelemetrySensorType;
|
} meshtastic_TelemetrySensorType;
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
@@ -436,8 +434,8 @@ extern "C" {
|
|||||||
|
|
||||||
/* Helper constants for enums */
|
/* Helper constants for enums */
|
||||||
#define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET
|
#define _meshtastic_TelemetrySensorType_MIN meshtastic_TelemetrySensorType_SENSOR_UNSET
|
||||||
#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_TSL2561
|
#define _meshtastic_TelemetrySensorType_MAX meshtastic_TelemetrySensorType_SEN5X
|
||||||
#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_TSL2561+1))
|
#define _meshtastic_TelemetrySensorType_ARRAYSIZE ((meshtastic_TelemetrySensorType)(meshtastic_TelemetrySensorType_SEN5X+1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -718,13 +718,6 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
|
|||||||
requiresReboot = false;
|
requiresReboot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ARCH_PORTDUINO)
|
|
||||||
// If running on portduino and using SimRadio, do not require reboot
|
|
||||||
if (SimRadio::instance) {
|
|
||||||
requiresReboot = false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RF95_FAN_EN
|
#ifdef RF95_FAN_EN
|
||||||
// Turn PA off if disabled by config
|
// Turn PA off if disabled by config
|
||||||
if (c.payload_variant.lora.pa_fan_disabled) {
|
if (c.payload_variant.lora.pa_fan_disabled) {
|
||||||
|
|||||||
@@ -279,8 +279,6 @@ struct PubSubConfig {
|
|||||||
|
|
||||||
// Defaults
|
// Defaults
|
||||||
static constexpr uint16_t defaultPort = 1883;
|
static constexpr uint16_t defaultPort = 1883;
|
||||||
static constexpr uint16_t defaultPortTls = 8883;
|
|
||||||
|
|
||||||
uint16_t serverPort = defaultPort;
|
uint16_t serverPort = defaultPort;
|
||||||
String serverAddr = default_mqtt_address;
|
String serverAddr = default_mqtt_address;
|
||||||
const char *mqttUsername = default_mqtt_username;
|
const char *mqttUsername = default_mqtt_username;
|
||||||
@@ -643,7 +641,7 @@ bool MQTT::isValidConfig(const meshtastic_ModuleConfig_MQTTConfig &config, MQTTC
|
|||||||
}
|
}
|
||||||
|
|
||||||
const bool defaultServer = isDefaultServer(parsed.serverAddr);
|
const bool defaultServer = isDefaultServer(parsed.serverAddr);
|
||||||
if (defaultServer && !IS_ONE_OF(parsed.serverPort, PubSubConfig::defaultPort, PubSubConfig::defaultPortTls)) {
|
if (defaultServer && parsed.serverPort != PubSubConfig::defaultPort) {
|
||||||
const char *warning = "Invalid MQTT config: default server address must not have a port specified";
|
const char *warning = "Invalid MQTT config: default server address must not have a port specified";
|
||||||
LOG_ERROR(warning);
|
LOG_ERROR(warning);
|
||||||
#if !IS_RUNNING_TESTS
|
#if !IS_RUNNING_TESTS
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include "linux/gpio/LinuxGPIOPin.h"
|
#include "linux/gpio/LinuxGPIOPin.h"
|
||||||
#include "meshUtils.h"
|
#include "meshUtils.h"
|
||||||
#include "yaml-cpp/yaml.h"
|
#include "yaml-cpp/yaml.h"
|
||||||
#include <ErriezCRC32.h>
|
|
||||||
#include <Utility.h>
|
#include <Utility.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
@@ -30,11 +29,11 @@
|
|||||||
|
|
||||||
std::map<configNames, int> settingsMap;
|
std::map<configNames, int> settingsMap;
|
||||||
std::map<configNames, std::string> settingsStrings;
|
std::map<configNames, std::string> settingsStrings;
|
||||||
portduino_config_struct portduino_config;
|
|
||||||
std::ofstream traceFile;
|
std::ofstream traceFile;
|
||||||
Ch341Hal *ch341Hal = nullptr;
|
Ch341Hal *ch341Hal = nullptr;
|
||||||
char *configPath = nullptr;
|
char *configPath = nullptr;
|
||||||
char *optionMac = nullptr;
|
char *optionMac = nullptr;
|
||||||
|
bool forceSimulated = false;
|
||||||
bool verboseEnabled = false;
|
bool verboseEnabled = false;
|
||||||
|
|
||||||
const char *argp_program_version = optstr(APP_VERSION);
|
const char *argp_program_version = optstr(APP_VERSION);
|
||||||
@@ -67,7 +66,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
|
|||||||
configPath = arg;
|
configPath = arg;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
portduino_config.force_simradio = true;
|
forceSimulated = true;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
optionMac = arg;
|
optionMac = arg;
|
||||||
@@ -190,7 +189,7 @@ void portduinoSetup()
|
|||||||
|
|
||||||
YAML::Node yamlConfig;
|
YAML::Node yamlConfig;
|
||||||
|
|
||||||
if (portduino_config.force_simradio == true) {
|
if (forceSimulated == true) {
|
||||||
settingsMap[use_simradio] = true;
|
settingsMap[use_simradio] = true;
|
||||||
} else if (configPath != nullptr) {
|
} else if (configPath != nullptr) {
|
||||||
if (loadConfig(configPath)) {
|
if (loadConfig(configPath)) {
|
||||||
@@ -254,95 +253,16 @@ void portduinoSetup()
|
|||||||
std::cout << "autoconf: Could not locate CH341 device" << std::endl;
|
std::cout << "autoconf: Could not locate CH341 device" << std::endl;
|
||||||
}
|
}
|
||||||
// Try Pi HAT+
|
// Try Pi HAT+
|
||||||
if (strlen(autoconf_product) < 6) {
|
std::cout << "autoconf: Looking for Pi HAT+..." << std::endl;
|
||||||
std::cout << "autoconf: Looking for Pi HAT+..." << std::endl;
|
if (access("/proc/device-tree/hat/product", R_OK) == 0) {
|
||||||
if (access("/proc/device-tree/hat/product", R_OK) == 0) {
|
std::ifstream hatProductFile("/proc/device-tree/hat/product");
|
||||||
std::ifstream hatProductFile("/proc/device-tree/hat/product");
|
if (hatProductFile.is_open()) {
|
||||||
if (hatProductFile.is_open()) {
|
hatProductFile.read(autoconf_product, 95);
|
||||||
hatProductFile.read(autoconf_product, 95);
|
hatProductFile.close();
|
||||||
hatProductFile.close();
|
|
||||||
}
|
|
||||||
std::cout << "autoconf: Found Pi HAT+ " << autoconf_product << " at /proc/device-tree/hat/product" << std::endl;
|
|
||||||
} else {
|
|
||||||
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
|
|
||||||
// RAK6421-13300-S1:aabbcc123456:5ba85807d92138b7519cfb60460573af:3061e8d8
|
|
||||||
// <model string>:mac address :<16 random unique bytes in hexidecimal> : crc32
|
|
||||||
// crc32 is calculated on the eeprom string up to but not including the final colon
|
|
||||||
if (strlen(autoconf_product) < 6) {
|
|
||||||
try {
|
|
||||||
char *mac_start = nullptr;
|
|
||||||
char *devID_start = nullptr;
|
|
||||||
char *crc32_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);
|
|
||||||
std::string autoconf_raw;
|
|
||||||
while (Wire.available() && i < sizeof(autoconf_product)) {
|
|
||||||
autoconf_product[i] = Wire.read();
|
|
||||||
if (autoconf_product[i] == 0xff) {
|
|
||||||
autoconf_product[i] = 0x0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
autoconf_raw += autoconf_product[i];
|
|
||||||
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;
|
|
||||||
} else if (crc32_start == nullptr) {
|
|
||||||
crc32_start = autoconf_product + i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (crc32_start != nullptr && strlen(crc32_start) == 8) {
|
|
||||||
std::string crc32_str(crc32_start);
|
|
||||||
uint32_t crc32_value = 0;
|
|
||||||
|
|
||||||
// convert crc32 ascii to raw uint32
|
|
||||||
for (int j = 0; j < 4; j++) {
|
|
||||||
crc32_value += std::stoi(crc32_str.substr(j * 2, 2), nullptr, 16) << (3 - j) * 8;
|
|
||||||
}
|
|
||||||
std::cout << "autoconf: Found eeprom crc " << crc32_start << std::endl;
|
|
||||||
|
|
||||||
// set the autoconf string to blank and short circuit
|
|
||||||
if (crc32_value != crc32Buffer(autoconf_raw.c_str(), i - 9)) {
|
|
||||||
std::cout << "autoconf: crc32 mismatch, dropping " << std::endl;
|
|
||||||
autoconf_product[0] = 0x0;
|
|
||||||
} else {
|
|
||||||
std::cout << "autoconf: Found eeprom data " << autoconf_raw << std::endl;
|
|
||||||
if (mac_start != nullptr) {
|
|
||||||
std::cout << "autoconf: Found mac data " << mac_start << std::endl;
|
|
||||||
if (strlen(mac_start) == 12)
|
|
||||||
settingsStrings[mac_address] = std::string(mac_start);
|
|
||||||
}
|
|
||||||
if (devID_start != nullptr) {
|
|
||||||
std::cout << "autoconf: Found deviceid data " << devID_start << std::endl;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
std::cout << "autoconf: crc32 missing " << std::endl;
|
|
||||||
autoconf_product[0] = 0x0;
|
|
||||||
}
|
|
||||||
} catch (...) {
|
|
||||||
std::cout << "autoconf: Could not locate EEPROM" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
std::cout << "autoconf: Found Pi HAT+ " << autoconf_product << " at /proc/device-tree/hat/product" << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << "autoconf: Could not locate Pi HAT+ at /proc/device-tree/hat/product" << 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) {
|
||||||
@@ -633,48 +553,6 @@ bool loadConfig(const char *configPath)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]) {
|
|
||||||
portduino_config.has_rfswitch_table = true;
|
|
||||||
portduino_config.rfswitch_table[0].mode = LR11x0::MODE_STBY;
|
|
||||||
portduino_config.rfswitch_table[1].mode = LR11x0::MODE_RX;
|
|
||||||
portduino_config.rfswitch_table[2].mode = LR11x0::MODE_TX;
|
|
||||||
portduino_config.rfswitch_table[3].mode = LR11x0::MODE_TX_HP;
|
|
||||||
portduino_config.rfswitch_table[4].mode = LR11x0::MODE_TX_HF;
|
|
||||||
portduino_config.rfswitch_table[5].mode = LR11x0::MODE_GNSS;
|
|
||||||
portduino_config.rfswitch_table[6].mode = LR11x0::MODE_WIFI;
|
|
||||||
portduino_config.rfswitch_table[7] = END_OF_MODE_TABLE;
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
|
|
||||||
// set up the pin array first
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["pins"][i].as<std::string>("") == "DIO5")
|
|
||||||
portduino_config.rfswitch_dio_pins[i] = RADIOLIB_LR11X0_DIO5;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["pins"][i].as<std::string>("") == "DIO6")
|
|
||||||
portduino_config.rfswitch_dio_pins[i] = RADIOLIB_LR11X0_DIO6;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["pins"][i].as<std::string>("") == "DIO7")
|
|
||||||
portduino_config.rfswitch_dio_pins[i] = RADIOLIB_LR11X0_DIO7;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["pins"][i].as<std::string>("") == "DIO8")
|
|
||||||
portduino_config.rfswitch_dio_pins[i] = RADIOLIB_LR11X0_DIO8;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["pins"][i].as<std::string>("") == "DIO10")
|
|
||||||
portduino_config.rfswitch_dio_pins[i] = RADIOLIB_LR11X0_DIO10;
|
|
||||||
|
|
||||||
// now fill in the table
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["MODE_STBY"][i].as<std::string>("") == "HIGH")
|
|
||||||
portduino_config.rfswitch_table[0].values[i] = HIGH;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["MODE_RX"][i].as<std::string>("") == "HIGH")
|
|
||||||
portduino_config.rfswitch_table[1].values[i] = HIGH;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["MODE_TX"][i].as<std::string>("") == "HIGH")
|
|
||||||
portduino_config.rfswitch_table[2].values[i] = HIGH;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["MODE_TX_HP"][i].as<std::string>("") == "HIGH")
|
|
||||||
portduino_config.rfswitch_table[3].values[i] = HIGH;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["MODE_TX_HF"][i].as<std::string>("") == "HIGH")
|
|
||||||
portduino_config.rfswitch_table[4].values[i] = HIGH;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["MODE_GNSS"][i].as<std::string>("") == "HIGH")
|
|
||||||
portduino_config.rfswitch_table[5].values[i] = HIGH;
|
|
||||||
if (yamlConfig["Lora"]["rfswitch_table"]["MODE_WIFI"][i].as<std::string>("") == "HIGH")
|
|
||||||
portduino_config.rfswitch_table[6].values[i] = HIGH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (yamlConfig["GPIO"]) {
|
if (yamlConfig["GPIO"]) {
|
||||||
settingsMap[userButtonPin] = yamlConfig["GPIO"]["User"].as<int>(RADIOLIB_NC);
|
settingsMap[userButtonPin] = yamlConfig["GPIO"]["User"].as<int>(RADIOLIB_NC);
|
||||||
|
|||||||
@@ -3,21 +3,16 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "LR11x0Interface.h"
|
|
||||||
#include "Module.h"
|
|
||||||
#include "platform/portduino/USBHal.h"
|
#include "platform/portduino/USBHal.h"
|
||||||
|
|
||||||
// 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 = {
|
inline const std::unordered_map<std::string, std::string> configProducts = {{"MESHTOAD", "lora-usb-meshtoad-e22.yaml"},
|
||||||
{"MESHTOAD", "lora-usb-meshtoad-e22.yaml"},
|
{"MESHSTICK", "lora-meshstick-1262.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"}};
|
||||||
{"POWERPI", "lora-MeshAdv-900M30S.yaml"},
|
|
||||||
{"RAK6421-13300-S1", "lora-RAK6421-13300-slot1.yaml"},
|
|
||||||
{"RAK6421-13300-S2", "lora-RAK6421-13300-slot2.yaml"}};
|
|
||||||
|
|
||||||
enum configNames {
|
enum configNames {
|
||||||
default_gpiochip,
|
default_gpiochip,
|
||||||
@@ -131,13 +126,4 @@ bool loadConfig(const char *configPath);
|
|||||||
static bool ends_with(std::string_view str, std::string_view suffix);
|
static bool ends_with(std::string_view str, std::string_view suffix);
|
||||||
void getMacAddr(uint8_t *dmac);
|
void getMacAddr(uint8_t *dmac);
|
||||||
bool MAC_from_string(std::string mac_str, uint8_t *dmac);
|
bool MAC_from_string(std::string mac_str, uint8_t *dmac);
|
||||||
std::string exec(const char *cmd);
|
std::string exec(const char *cmd);
|
||||||
|
|
||||||
extern struct portduino_config_struct {
|
|
||||||
bool has_rfswitch_table = false;
|
|
||||||
uint32_t rfswitch_dio_pins[5] = {RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC};
|
|
||||||
Module::RfSwitchMode_t rfswitch_table[8];
|
|
||||||
bool force_simradio = false;
|
|
||||||
bool has_device_id = false;
|
|
||||||
uint8_t device_id[16] = {0};
|
|
||||||
} portduino_config;
|
|
||||||
@@ -25,6 +25,7 @@ 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
|
||||||
@@ -40,25 +41,6 @@ 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
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
; MeshTiny - Custom device based on GAT562 with encoder and buzzer support
|
|
||||||
[env:meshtiny]
|
|
||||||
extends = nrf52840_base
|
|
||||||
board = meshtiny
|
|
||||||
board_level = extra
|
|
||||||
build_flags = ${nrf52840_base.build_flags} -Ivariants/nrf52840/meshtiny -D MESHTINY
|
|
||||||
-DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely.
|
|
||||||
-DRADIOLIB_EXCLUDE_SX128X=1
|
|
||||||
-DRADIOLIB_EXCLUDE_SX127X=1
|
|
||||||
-DRADIOLIB_EXCLUDE_LR11X0=1
|
|
||||||
-D INPUTDRIVER_ENCODER_TYPE=2
|
|
||||||
-D INPUTDRIVER_ENCODER_UP=4
|
|
||||||
-D INPUTDRIVER_ENCODER_DOWN=26
|
|
||||||
-D INPUTDRIVER_ENCODER_BTN=28
|
|
||||||
-D USE_PIN_BUZZER=PIN_BUZZER
|
|
||||||
-D MESHTASTIC_EXCLUDE_GPS=1
|
|
||||||
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/meshtiny>
|
|
||||||
lib_deps =
|
|
||||||
${nrf52840_base.lib_deps}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
|
||||||
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
|
||||||
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
See the GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "variant.h"
|
|
||||||
#include "nrf.h"
|
|
||||||
#include "wiring_constants.h"
|
|
||||||
#include "wiring_digital.h"
|
|
||||||
|
|
||||||
const uint32_t g_ADigitalPinMap[] = {
|
|
||||||
// P0
|
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
|
||||||
|
|
||||||
// P1
|
|
||||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
|
|
||||||
|
|
||||||
void initVariant()
|
|
||||||
{
|
|
||||||
// LED1 & LED2
|
|
||||||
pinMode(PIN_LED1, OUTPUT);
|
|
||||||
ledOff(PIN_LED1);
|
|
||||||
|
|
||||||
pinMode(PIN_LED2, OUTPUT);
|
|
||||||
ledOff(PIN_LED2);
|
|
||||||
|
|
||||||
// 3V3 Power Rail
|
|
||||||
pinMode(PIN_3V3_EN, OUTPUT);
|
|
||||||
digitalWrite(PIN_3V3_EN, HIGH);
|
|
||||||
|
|
||||||
// Initialize Encoder pins
|
|
||||||
pinMode(INPUTDRIVER_ENCODER_UP, INPUT_PULLUP);
|
|
||||||
pinMode(INPUTDRIVER_ENCODER_DOWN, INPUT_PULLUP);
|
|
||||||
pinMode(INPUTDRIVER_ENCODER_BTN, INPUT_PULLUP);
|
|
||||||
|
|
||||||
// Initialize Buzzer pin
|
|
||||||
pinMode(PIN_BUZZER, OUTPUT);
|
|
||||||
digitalWrite(PIN_BUZZER, LOW);
|
|
||||||
}
|
|
||||||
@@ -1,199 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
|
||||||
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
|
||||||
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation; either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
See the GNU Lesser General Public License for more details.
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _VARIANT_MESHTINY_
|
|
||||||
#define _VARIANT_MESHTINY_
|
|
||||||
|
|
||||||
#define MESHTINY
|
|
||||||
|
|
||||||
// #define RAK4630
|
|
||||||
|
|
||||||
/** Master clock frequency */
|
|
||||||
#define VARIANT_MCK (64000000ul)
|
|
||||||
|
|
||||||
#define USE_LFXO // Board uses 32khz crystal for LF
|
|
||||||
// define USE_LFRC // Board uses RC for LF
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
|
||||||
* Headers
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "WVariant.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
// Number of pins defined in PinDescription array
|
|
||||||
#define PINS_COUNT (48)
|
|
||||||
#define NUM_DIGITAL_PINS (48)
|
|
||||||
#define NUM_ANALOG_INPUTS (6)
|
|
||||||
#define NUM_ANALOG_OUTPUTS (0)
|
|
||||||
|
|
||||||
// LEDs
|
|
||||||
#define PIN_LED1 (35)
|
|
||||||
#define PIN_LED2 (36)
|
|
||||||
|
|
||||||
#define LED_BUILTIN PIN_LED1
|
|
||||||
#define LED_CONN PIN_LED2
|
|
||||||
|
|
||||||
#define LED_GREEN PIN_LED1
|
|
||||||
#define LED_BLUE PIN_LED2
|
|
||||||
|
|
||||||
#define LED_STATE_ON 1 // State when LED is litted
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Encoder
|
|
||||||
*/
|
|
||||||
#define INPUTDRIVER_ENCODER_TYPE 2
|
|
||||||
#define INPUTDRIVER_ENCODER_UP 26
|
|
||||||
#define INPUTDRIVER_ENCODER_DOWN 4
|
|
||||||
#define INPUTDRIVER_ENCODER_BTN 28
|
|
||||||
|
|
||||||
#define CANNED_MESSAGE_MODULE_ENABLE 1
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Buzzer - PWM
|
|
||||||
*/
|
|
||||||
#define PIN_BUZZER 30
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Buttons
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define PIN_BUTTON1 9
|
|
||||||
#define BUTTON_NEED_PULLUP
|
|
||||||
#define PIN_BUTTON2 12
|
|
||||||
#define PIN_BUTTON3 24
|
|
||||||
#define PIN_BUTTON4 25
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Analog pins
|
|
||||||
*/
|
|
||||||
#define PIN_A0 (5)
|
|
||||||
#define PIN_A1 (31)
|
|
||||||
#define PIN_A2 (28)
|
|
||||||
#define PIN_A3 (29)
|
|
||||||
#define PIN_A4 (30)
|
|
||||||
#define PIN_A5 (31)
|
|
||||||
#define PIN_A6 (0xff)
|
|
||||||
#define PIN_A7 (0xff)
|
|
||||||
|
|
||||||
static const uint8_t A0 = PIN_A0;
|
|
||||||
static const uint8_t A1 = PIN_A1;
|
|
||||||
static const uint8_t A2 = PIN_A2;
|
|
||||||
static const uint8_t A3 = PIN_A3;
|
|
||||||
static const uint8_t A4 = PIN_A4;
|
|
||||||
static const uint8_t A5 = PIN_A5;
|
|
||||||
static const uint8_t A6 = PIN_A6;
|
|
||||||
static const uint8_t A7 = PIN_A7;
|
|
||||||
#define ADC_RESOLUTION 14
|
|
||||||
|
|
||||||
// Other pins
|
|
||||||
#define PIN_AREF (2)
|
|
||||||
#define PIN_NFC1 (9)
|
|
||||||
#define PIN_NFC2 (10)
|
|
||||||
|
|
||||||
static const uint8_t AREF = PIN_AREF;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Serial interfaces
|
|
||||||
*/
|
|
||||||
#define PIN_SERIAL1_RX (15)
|
|
||||||
#define PIN_SERIAL1_TX (16)
|
|
||||||
|
|
||||||
// Connected to Jlink CDC
|
|
||||||
#define PIN_SERIAL2_RX (8)
|
|
||||||
#define PIN_SERIAL2_TX (6)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SPI Interfaces
|
|
||||||
*/
|
|
||||||
#define SPI_INTERFACES_COUNT 2
|
|
||||||
|
|
||||||
#define PIN_SPI_MISO (45)
|
|
||||||
#define PIN_SPI_MOSI (44)
|
|
||||||
#define PIN_SPI_SCK (43)
|
|
||||||
|
|
||||||
#define PIN_SPI1_MISO (29) // (0 + 29)
|
|
||||||
#define PIN_SPI1_MOSI (30) // (0 + 30)
|
|
||||||
#define PIN_SPI1_SCK (3) // (0 + 3)
|
|
||||||
|
|
||||||
static const uint8_t SS = 42;
|
|
||||||
static const uint8_t MOSI = PIN_SPI_MOSI;
|
|
||||||
static const uint8_t MISO = PIN_SPI_MISO;
|
|
||||||
static const uint8_t SCK = PIN_SPI_SCK;
|
|
||||||
|
|
||||||
#define HAS_SCREEN 1
|
|
||||||
#define USE_SSD1306
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wire Interfaces
|
|
||||||
*/
|
|
||||||
#define WIRE_INTERFACES_COUNT 1
|
|
||||||
|
|
||||||
#define PIN_WIRE_SDA (13)
|
|
||||||
#define PIN_WIRE_SCL (14)
|
|
||||||
|
|
||||||
// QSPI Pins
|
|
||||||
#define PIN_QSPI_SCK 3
|
|
||||||
#define PIN_QSPI_CS 22 // Changed from 26 to avoid conflict with encoder
|
|
||||||
#define PIN_QSPI_IO0 27 // Changed from 30 to avoid conflict with buzzer
|
|
||||||
#define PIN_QSPI_IO1 29
|
|
||||||
#define PIN_QSPI_IO2 21 // Changed from 28 to avoid conflict with encoder button
|
|
||||||
#define PIN_QSPI_IO3 2
|
|
||||||
|
|
||||||
// On-board QSPI Flash
|
|
||||||
#define EXTERNAL_FLASH_DEVICES IS25LP080D
|
|
||||||
#define EXTERNAL_FLASH_USE_QSPI
|
|
||||||
|
|
||||||
#define USE_SX1262
|
|
||||||
#define SX126X_CS (42)
|
|
||||||
#define SX126X_DIO1 (47)
|
|
||||||
#define SX126X_BUSY (46)
|
|
||||||
#define SX126X_RESET (38)
|
|
||||||
#define SX126X_POWER_EN (37)
|
|
||||||
// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
|
|
||||||
#define SX126X_DIO2_AS_RF_SWITCH
|
|
||||||
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
|
||||||
|
|
||||||
// Testing USB detection
|
|
||||||
#define NRF_APM
|
|
||||||
|
|
||||||
#define PIN_3V3_EN (34)
|
|
||||||
|
|
||||||
// Battery
|
|
||||||
// The battery sense is hooked to pin A0 (5)
|
|
||||||
#define BATTERY_PIN PIN_A0
|
|
||||||
// and has 12 bit resolution
|
|
||||||
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
|
||||||
#define BATTERY_SENSE_RESOLUTION 4096.0
|
|
||||||
#undef AREF_VOLTAGE
|
|
||||||
#define AREF_VOLTAGE 3.0
|
|
||||||
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
|
||||||
#define ADC_MULTIPLIER 1.73
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
|
||||||
* Arduino objects - C++ only
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user