mirror of
https://github.com/liberatedsystems/RNode_Firmware_CE.git
synced 2024-07-02 14:34:13 +02:00
Compare commits
5 Commits
dcb8388ca9
...
055083ffba
Author | SHA1 | Date | |
---|---|---|---|
|
055083ffba | ||
|
f3558b66fc | ||
|
266fd6f8bd | ||
|
66fc47124c | ||
|
35d9ec2bab |
11
.github/ISSUE_TEMPLATE/config.yml
vendored
11
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,11 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: ✨ Feature Request or Idea
|
||||
url: https://github.com/markqvist/Reticulum/discussions/new?category=ideas
|
||||
about: Propose and discuss features and ideas
|
||||
- name: 💬 Questions, Help & Discussion
|
||||
about: Ask anything, or get help
|
||||
url: https://github.com/markqvist/Reticulum/discussions/new/choose
|
||||
- name: 📖 Read the Reticulum Manual
|
||||
url: https://markqvist.github.io/Reticulum/manual/
|
||||
about: The complete documentation for Reticulum
|
35
.github/ISSUE_TEMPLATE/🐛-bug-report.md
vendored
35
.github/ISSUE_TEMPLATE/🐛-bug-report.md
vendored
@ -1,35 +0,0 @@
|
||||
---
|
||||
name: "\U0001F41B Bug Report"
|
||||
about: Report a reproducible bug
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Read the Contribution Guidelines**
|
||||
Before creating a bug report on this issue tracker, you **must** read the [Contribution Guidelines](https://github.com/markqvist/Reticulum/blob/master/Contributing.md). Issues that do not follow the contribution guidelines **will be deleted without comment**.
|
||||
|
||||
- The issue tracker is used by developers of this project. **Do not use it to ask general questions, or for support requests**.
|
||||
- Ideas and feature requests can be made on the [Discussions](https://github.com/markqvist/Reticulum/discussions). **Only** feature requests accepted by maintainers and developers are tracked and included on the issue tracker. **Do not post feature requests here**.
|
||||
- After reading the [Contribution Guidelines](https://github.com/markqvist/Reticulum/blob/master/Contributing.md), delete this section from your bug report.
|
||||
|
||||
**Describe the Bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Describe in detail how to reproduce the bug.
|
||||
|
||||
**Expected Behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Logs & Screenshots**
|
||||
Please include any relevant log output. If applicable, also add screenshots to help explain your problem.
|
||||
|
||||
**System Information**
|
||||
- OS and version
|
||||
- Python version
|
||||
- Program version
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
17
Bluetooth.h
17
Bluetooth.h
@ -13,12 +13,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
|
||||
|
||||
#elif MCU_VARIANT == MCU_NRF52
|
||||
#endif
|
||||
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
#if HAS_BLUETOOTH == true
|
||||
#include "BluetoothSerial.h"
|
||||
@ -265,6 +259,8 @@ void bt_disable_pairing() {
|
||||
|
||||
void bt_pairing_complete(uint16_t conn_handle, uint8_t auth_status) {
|
||||
if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS) {
|
||||
bt_state = BT_STATE_CONNECTED;
|
||||
cable_state = CABLE_STATE_DISCONNECTED;
|
||||
bt_disable_pairing();
|
||||
} else {
|
||||
bt_ssp_pin = 0;
|
||||
@ -285,11 +281,6 @@ bool bt_passkey_callback(uint16_t conn_handle, uint8_t const passkey[6], bool ma
|
||||
return false;
|
||||
}
|
||||
|
||||
void bt_connect_callback(uint16_t conn_handle) {
|
||||
bt_state = BT_STATE_CONNECTED;
|
||||
cable_state = CABLE_STATE_DISCONNECTED;
|
||||
}
|
||||
|
||||
void bt_disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
||||
bt_state = BT_STATE_ON;
|
||||
}
|
||||
@ -308,10 +299,9 @@ bool bt_setup_hw() {
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
Bluefruit.autoConnLed(false);
|
||||
if (Bluefruit.begin()) {
|
||||
Bluefruit.setTxPower(4); // Check bluefruit.h for supported values
|
||||
Bluefruit.setTxPower(8); // Check bluefruit.h for supported values
|
||||
Bluefruit.Security.setIOCaps(true, true, false);
|
||||
Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback);
|
||||
Bluefruit.Periph.setConnectCallback(bt_connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback);
|
||||
Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete);
|
||||
const ble_gap_addr_t gap_addr = Bluefruit.getAddr();
|
||||
@ -348,7 +338,6 @@ void bt_start() {
|
||||
|
||||
blebas.begin();
|
||||
|
||||
// non-connectable advertising
|
||||
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
|
||||
Bluefruit.Advertising.addTxPower();
|
||||
|
||||
|
24
Boards.h
24
Boards.h
@ -43,6 +43,10 @@
|
||||
#define BOARD_GENERIC_NRF52 0x50
|
||||
#define BOARD_RAK4631 0x51
|
||||
|
||||
#define OLED 0x01
|
||||
#define EINK_BW 0x02
|
||||
#define EINK_3C 0x03
|
||||
|
||||
#if defined(__AVR_ATmega1284P__)
|
||||
#define PLATFORM PLATFORM_AVR
|
||||
#define MCU_VARIANT MCU_1284P
|
||||
@ -147,6 +151,7 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_TBEAM
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
#define HAS_PMU true
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_BLE true
|
||||
@ -184,6 +189,7 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_LORA32_V1_0
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_BLE true
|
||||
#define HAS_CONSOLE true
|
||||
@ -201,6 +207,7 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_LORA32_V2_0
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_BLE true
|
||||
#define HAS_CONSOLE true
|
||||
@ -218,6 +225,7 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_LORA32_V2_1
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_BLE true
|
||||
#define HAS_PMU true
|
||||
@ -239,6 +247,7 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_HELTEC32_V2
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_CONSOLE true
|
||||
#define HAS_EEPROM true
|
||||
@ -292,6 +301,7 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_RNODE_NG_20
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_NP true
|
||||
#define HAS_CONSOLE true
|
||||
@ -312,6 +322,7 @@
|
||||
|
||||
#elif BOARD_MODEL == BOARD_RNODE_NG_21
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_CONSOLE true
|
||||
#define HAS_PMU true
|
||||
@ -346,6 +357,7 @@
|
||||
#define HAS_TCXO true
|
||||
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY OLED
|
||||
#define HAS_CONSOLE false
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
@ -397,11 +409,12 @@
|
||||
#elif MCU_VARIANT == MCU_NRF52
|
||||
#if BOARD_MODEL == BOARD_RAK4631
|
||||
#define HAS_EEPROM false
|
||||
#define HAS_DISPLAY false
|
||||
#define HAS_DISPLAY true
|
||||
#define DISPLAY EINK_3C
|
||||
#define HAS_BLUETOOTH false
|
||||
#define HAS_BLE true
|
||||
#define HAS_CONSOLE false
|
||||
#define HAS_PMU false
|
||||
#define HAS_PMU true
|
||||
#define HAS_NP false
|
||||
#define HAS_SD false
|
||||
#define HAS_TCXO true
|
||||
@ -425,6 +438,13 @@
|
||||
const int pin_miso = 45;
|
||||
const int pin_busy = 46;
|
||||
const int pin_dio = 47;
|
||||
|
||||
const int pin_disp_cs = SS;
|
||||
const int pin_disp_dc = WB_IO1;
|
||||
const int pin_disp_reset = -1;
|
||||
const int pin_disp_busy = WB_IO4;
|
||||
const int pin_disp_en = WB_IO2;
|
||||
|
||||
const int pin_led_rx = LED_BLUE;
|
||||
const int pin_led_tx = LED_GREEN;
|
||||
const int pin_tcxo_enable = -1;
|
||||
|
@ -11,7 +11,7 @@ This entry should include, at a minimum, the following:
|
||||
* RX and TX leds (preferably LEDs of different colours)
|
||||
|
||||
An example of a minimal entry can be seen below:
|
||||
`
|
||||
```
|
||||
#elif BOARD_MODEL == BOARD_MY_WICKED_BOARD
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_PMU true
|
||||
@ -28,7 +28,7 @@ An example of a minimal entry can be seen below:
|
||||
// const int pin_busy = 0; not present
|
||||
const int pin_led_rx = 5;
|
||||
const int pin_led_tx = 6;
|
||||
`
|
||||
```
|
||||
|
||||
In some cases the SPI pins will not be required, as they will be the default pins for the SPI library supporting the board anyway, and therefore do not need overriding in the config.
|
||||
|
||||
@ -39,7 +39,7 @@ If the SX1262 is being used the following should also be considered:
|
||||
* the enable pin for the TCXO (if present)
|
||||
|
||||
An example of an entry using the SX1262 modem can be seen below:
|
||||
`
|
||||
```
|
||||
#elif BOARD_MODEL == BOARD_MY_WICKED_BOARD
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_PMU true
|
||||
@ -62,13 +62,13 @@ An example of an entry using the SX1262 modem can be seen below:
|
||||
const int pin_tcxo_enable = -1;
|
||||
const int pin_led_rx = 5;
|
||||
const int pin_led_tx = 6;
|
||||
`
|
||||
```
|
||||
|
||||
If the SX1280 is being used, the following should also be added:
|
||||
* the TXEN and RXEN pins
|
||||
|
||||
An example of an entry using the SX1280 modem can be seen below:
|
||||
`
|
||||
```
|
||||
#elif BOARD_MODEL == BOARD_MY_WICKED_BOARD
|
||||
#define HAS_BLUETOOTH true
|
||||
#define HAS_PMU true
|
||||
@ -91,12 +91,12 @@ An example of an entry using the SX1280 modem can be seen below:
|
||||
const int pin_tcxo_enable = -1;
|
||||
const int pin_led_rx = 5;
|
||||
const int pin_led_tx = 6;
|
||||
`
|
||||
```
|
||||
|
||||
Please submit this, and any other support in different areas of the project your board may require, as a PR for my consideration.
|
||||
|
||||
# Feature request
|
||||
Feature requests are welcomed, given that those requesting it are happy to write it themselves, or a contributor considers it to be important enough to them to write it themselves. They must be written and **properly** tested before being proposed as a pull request for the project on [GitHub](https://github.com/liberatedsystems/RNode_Firmware_CE). **Manufacturers are encouraged to contribute support for their products back to this repository**, and such support will be receieved gladly, given it does not effect support for other products or boards.
|
||||
Feature requests are welcomed, given that those requesting it are happy to write it themselves, or a contributor considers it to be important enough to them to write it themselves. They must be written and **properly** tested before being proposed as a pull request for the project on [GitHub](https://github.com/liberatedsystems/RNode_Firmware_CE). **Manufacturers are encouraged to contribute support for their products back to this repository**, and such support will be received gladly, given it does not effect support for other products or boards.
|
||||
|
||||
# Caveat
|
||||
All contributions must not be written using **any** LLM (ChatGPT, etc.), please handwrite them **only**. Any PRs with proposed contributions which have been discovered to be written using an LLM will **NOT** be merged. The contributor concerned may rewrite their entire pull request **by hand** and it may be reconsidered for merging in the future.
|
1674
Graphics.h
1674
Graphics.h
File diff suppressed because it is too large
Load Diff
95
Power.h
95
Power.h
@ -44,6 +44,26 @@
|
||||
int bat_charged_samples = 0;
|
||||
bool bat_voltage_dropping = false;
|
||||
float bat_delay_v = 0;
|
||||
#elif BOARD_MODEL == BOARD_RAK4631
|
||||
#include "nrfx_power.h"
|
||||
#define BAT_C_SAMPLES 7
|
||||
#define BAT_D_SAMPLES 2
|
||||
#define BAT_V_MIN 2.75
|
||||
#define BAT_V_MAX 4.2
|
||||
#define BAT_V_FLOAT 4.22
|
||||
#define BAT_SAMPLES 5
|
||||
#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12 - bit ADC resolution = 3000mV / 4096
|
||||
#define VBAT_DIVIDER_COMP (1.73) // Compensation factor for the VBAT divider
|
||||
#define VBAT_MV_PER_LSB_FIN (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
|
||||
#define PIN_VBAT WB_A0
|
||||
float bat_p_samples[BAT_SAMPLES];
|
||||
float bat_v_samples[BAT_SAMPLES];
|
||||
uint8_t bat_samples_count = 0;
|
||||
int bat_discharging_samples = 0;
|
||||
int bat_charging_samples = 0;
|
||||
int bat_charged_samples = 0;
|
||||
bool bat_voltage_dropping = false;
|
||||
float bat_delay_v = 0;
|
||||
#endif
|
||||
|
||||
uint32_t last_pmu_update = 0;
|
||||
@ -193,6 +213,66 @@ void measure_battery() {
|
||||
else {
|
||||
battery_ready = false;
|
||||
}
|
||||
|
||||
#elif BOARD_MODEL == BOARD_RAK4631
|
||||
battery_installed = true;
|
||||
battery_indeterminate = false;
|
||||
|
||||
bat_v_samples[bat_samples_count%BAT_SAMPLES] = (float)(analogRead(PIN_VBAT)) * VBAT_MV_PER_LSB_FIN;
|
||||
|
||||
if (bat_v_samples[bat_samples_count%BAT_SAMPLES] < 3300) {
|
||||
bat_p_samples[bat_samples_count%BAT_SAMPLES] = 0;
|
||||
}
|
||||
else if (bat_v_samples[bat_samples_count%BAT_SAMPLES] < 3600)
|
||||
{
|
||||
bat_v_samples[bat_samples_count%BAT_SAMPLES] -= 3300;
|
||||
bat_p_samples[bat_samples_count%BAT_SAMPLES] = bat_v_samples[bat_samples_count%BAT_SAMPLES] / 30;
|
||||
} else {
|
||||
bat_v_samples[bat_samples_count%BAT_SAMPLES] -= 3600;
|
||||
}
|
||||
bat_p_samples[bat_samples_count%BAT_SAMPLES] = 10 + (bat_v_samples[bat_samples_count%BAT_SAMPLES] * 0.15F);
|
||||
|
||||
bat_samples_count++;
|
||||
if (!battery_ready && bat_samples_count >= BAT_SAMPLES) {
|
||||
battery_ready = true;
|
||||
}
|
||||
|
||||
battery_percent = 0;
|
||||
for (uint8_t bi = 0; bi < BAT_SAMPLES; bi++) {
|
||||
battery_percent += bat_p_samples[bi];
|
||||
}
|
||||
battery_percent = battery_percent/BAT_SAMPLES;
|
||||
|
||||
battery_voltage = 0;
|
||||
for (uint8_t bi = 0; bi < BAT_SAMPLES; bi++) {
|
||||
battery_voltage += bat_v_samples[bi];
|
||||
}
|
||||
battery_voltage = battery_voltage/BAT_SAMPLES;
|
||||
|
||||
if (bat_delay_v == 0) bat_delay_v = battery_voltage;
|
||||
if (battery_percent > 100.0) battery_percent = 100.0;
|
||||
if (battery_percent < 0.0) battery_percent = 0.0;
|
||||
|
||||
if (bat_samples_count%BAT_SAMPLES == 0) {
|
||||
if (battery_voltage < bat_delay_v && battery_voltage < BAT_V_FLOAT) {
|
||||
bat_voltage_dropping = true;
|
||||
} else {
|
||||
bat_voltage_dropping = false;
|
||||
}
|
||||
bat_samples_count = 0;
|
||||
}
|
||||
|
||||
nrfx_power_usb_state_t usbstate = nrfx_power_usbstatus_get();
|
||||
if (usbstate == NRFX_POWER_USB_STATE_CONNECTED || usbstate == NRFX_POWER_USB_STATE_READY) {
|
||||
// charging
|
||||
battery_state = BATTERY_STATE_CHARGING;
|
||||
} else {
|
||||
battery_state = BATTERY_STATE_DISCHARGING;
|
||||
}
|
||||
|
||||
if (battery_percent >= 98) {
|
||||
battery_state = BATTERY_STATE_CHARGED;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (battery_ready) {
|
||||
@ -341,6 +421,21 @@ bool init_pmu() {
|
||||
PMU->setPowerKeyPressOffTime(XPOWERS_POWEROFF_4S);
|
||||
|
||||
return true;
|
||||
#elif BOARD_MODEL == BOARD_RAK4631
|
||||
// board doesn't have PMU but we can measure batt voltage
|
||||
|
||||
// prep ADC for reading battery level
|
||||
analogReference(AR_INTERNAL_3_0);
|
||||
|
||||
// Set the resolution to 12-bit (0..4095)
|
||||
analogReadResolution(12);
|
||||
|
||||
// Let the ADC settle
|
||||
delay(1);
|
||||
|
||||
// Get a single ADC sample and throw it away
|
||||
float raw = analogRead(PIN_VBAT);
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@ You must have at least version `2.1.3` of `rnodeconf` installed to update the RN
|
||||
| Heltec LoRa32 v3 | [Buy here](https://heltec.org/project/wifi-lora-32-v3/) | SX1276/8 | ESP32 |
|
||||
| Homebrew ESP32 boards | | Any supported | ESP32 | This can be any board with an Adafruit Feather (or generic) ESP32 chip |
|
||||
|
||||
It's easy to create your own RNodes from one of the supported development boards and devices. If a device or board you want to use is not yet supported, you are welcome to [join the effort](/CONTRIBUTING.md) and help create a board definition and pin mapping for it!
|
||||
It's easy to create your own RNodes from one of the supported development boards and devices. If a device or board you want to use is not yet supported, you are welcome to [join the effort](Documentation/CONTRIBUTING.md) and help create a board definition and pin mapping for it!
|
||||
|
||||
<!--<img src="Documentation/images/devboards_1.webp" width="100%"/>-->
|
||||
|
||||
@ -113,6 +113,9 @@ For more detailed instruction and in-depth guides, you can have a look at some o
|
||||
- Once you've got the hang of it, start building RNodes for your community, or [even for selling them](https://unsigned.io/sell_rnodes.html)
|
||||
|
||||
## Support development
|
||||
### Contributing
|
||||
You can contribute features and board support to the project if you wish. Please see [here](Documentation/CONTRIBUTING.md).
|
||||
|
||||
### Hardware donations
|
||||
If you would like to see support added for a board which you possess, you may donate it to myself, Jacob Eva, so that I can implement support for it into this project. There will be no official timescale given for implementation however, but I will try my best when I have time :) Please [contact me (scroll to the bottom)](https://liberatedsystems.co.uk/about) if you wish to donate hardware to the project.
|
||||
|
||||
@ -139,6 +142,9 @@ You can help support the continued development of open, free and private communi
|
||||
```
|
||||
- Ko-Fi: https://ko-fi.com/markqvist
|
||||
|
||||
## FAQ
|
||||
Please see [here](Documentation/FAQ.md).
|
||||
|
||||
## License & Use
|
||||
The upstream RNode Firmware is Copyright © 2024 Mark Qvist / [unsigned.io](https://unsigned.io).
|
||||
The modified RNode Firmware CE (community edition) is Copyright © Jacob Eva / [Liberated Embedded Systems](https://liberatedsystems.co.uk) and is made available under the **GNU General Public License v3.0**.
|
||||
|
@ -166,6 +166,11 @@ void setup() {
|
||||
eeprom_update(eeprom_addr(ADDR_CONF_DSET), CONF_OK_BYTE);
|
||||
eeprom_update(eeprom_addr(ADDR_CONF_DINT), 0xFF);
|
||||
}
|
||||
#if DISPLAY == EINK_BW || DISPLAY == EINK_3C
|
||||
// Poll and process incoming serial commands whilst e-ink display is
|
||||
// refreshing to make device still seem responsive
|
||||
display_add_callback(process_serial);
|
||||
#endif
|
||||
disp_ready = display_init();
|
||||
update_display();
|
||||
#endif
|
||||
@ -1310,6 +1315,11 @@ void loop() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void process_serial() {
|
||||
buffer_serial();
|
||||
if (!fifo_isempty(&serialFIFO)) serial_poll();
|
||||
}
|
||||
|
||||
void sleep_now() {
|
||||
#if HAS_SLEEP == true
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_22
|
||||
|
Loading…
Reference in New Issue
Block a user