Refactor: FaketecBoard to PromicroBoard

This commit is contained in:
taco
2025-03-30 15:52:25 +11:00
parent 0d5c17f7ed
commit 01e98caea7
5 changed files with 32 additions and 32 deletions

View File

@@ -1,12 +1,12 @@
#include <Arduino.h>
#include "FaketecBoard.h"
#include "PromicroBoard.h"
#include <bluefruit.h>
#include <Wire.h>
static BLEDfu bledfu;
void FaketecBoard::begin() {
void PromicroBoard::begin() {
// for future use, sub-classes SHOULD call this from their begin()
startup_reason = BD_STARTUP_NORMAL;
btn_prev_state = HIGH;
@@ -39,7 +39,7 @@ static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
MESH_DEBUG_PRINTLN("BLE client disconnected");
}
bool FaketecBoard::startOTAUpdate(const char* id, char reply[]) {
bool PromicroBoard::startOTAUpdate(const char* id, char reply[]) {
// Config the peripheral connection with maximum bandwidth
// more SRAM required by SoftDevice
// Note: All config***() function must be called before begin()
@@ -50,7 +50,7 @@ bool FaketecBoard::startOTAUpdate(const char* id, char reply[]) {
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
Bluefruit.setTxPower(4);
// Set the BLE device name
Bluefruit.setName("Faketec_OTA");
Bluefruit.setName("ProMicro_OTA");
Bluefruit.Periph.setConnectCallback(connect_callback);
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);

View File

@@ -19,7 +19,7 @@
#define PIN_VBAT_READ 17
#define ADC_MULTIPLIER (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking
class FaketecBoard : public mesh::MainBoard {
class PromicroBoard : public mesh::MainBoard {
protected:
uint8_t startup_reason;
uint8_t btn_prev_state;
@@ -43,7 +43,7 @@ public:
}
const char* getManufacturerName() const override {
return "Faketec DIY";
return "ProMicro DIY";
}
int buttonStateChanged() {

View File

@@ -1,4 +1,4 @@
[faketec]
[Faketec]
extends = nrf52840_base
board = promicro_nrf52840
build_flags = ${nrf52840_base.build_flags}
@@ -15,17 +15,17 @@ build_flags = ${nrf52840_base.build_flags}
-D PIN_OLED_RESET=-1
-D PIN_USER_BTN=6
build_src_filter = ${nrf52840_base.build_src_filter}
+<helpers/nrf52/FaketecBoard.cpp>
+<helpers/nrf52/PromicroBoard.cpp>
+<../variants/promicro>
lib_deps=
${nrf52840_base.lib_deps}
adafruit/Adafruit SSD1306 @ ^2.5.13
[env:Faketec_Repeater]
extends = faketec
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_repeater> +<helpers/ui/*.cpp>
extends = Faketec
build_src_filter = ${Faketec.build_src_filter} +<../examples/simple_repeater> +<helpers/ui/*.cpp>
build_flags =
${faketec.build_flags}
${Faketec.build_flags}
-D ADVERT_NAME="\"Faketec Repeater\""
-D ADVERT_LAT=-37.0
-D ADVERT_LON=145.0
@@ -33,14 +33,14 @@ build_flags =
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
lib_deps =
${faketec.lib_deps}
${Faketec.lib_deps}
adafruit/RTClib @ ^2.1.3
[env:Faketec_room_server]
extends = faketec
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_room_server> +<helpers/ui/*.cpp>
extends = Faketec
build_src_filter = ${Faketec.build_src_filter} +<../examples/simple_room_server> +<helpers/ui/*.cpp>
build_flags =
${faketec.build_flags}
${Faketec.build_flags}
-D ADVERT_NAME="\"Test Room\""
-D ADVERT_LAT=-37.0
-D ADVERT_LON=145.0
@@ -49,41 +49,41 @@ build_flags =
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
lib_deps =
${faketec.lib_deps}
${Faketec.lib_deps}
adafruit/RTClib @ ^2.1.3
[env:Faketec_terminal_chat]
extends = faketec
extends = Faketec
build_flags =
${faketec.build_flags}
${Faketec.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_secure_chat/main.cpp>
build_src_filter = ${Faketec.build_src_filter} +<../examples/simple_secure_chat/main.cpp>
lib_deps =
${faketec.lib_deps}
${Faketec.lib_deps}
densaugeo/base64 @ ~1.4.0
adafruit/RTClib @ ^2.1.3
[env:Faketec_companion_radio_usb]
extends = faketec
extends = Faketec
build_flags =
${faketec.build_flags}
${Faketec.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
build_src_filter = ${faketec.build_src_filter} +<../examples/companion_radio> +<../examples/companion_radio> +<helpers/ui/*.cpp>
build_src_filter = ${Faketec.build_src_filter} +<../examples/companion_radio> +<../examples/companion_radio> +<helpers/ui/*.cpp>
lib_deps =
${faketec.lib_deps}
${Faketec.lib_deps}
adafruit/RTClib @ ^2.1.3
densaugeo/base64 @ ~1.4.0
[env:Faketec_companion_radio_ble]
extends = faketec
extends = Faketec
build_flags =
${faketec.build_flags}
${Faketec.build_flags}
-D MAX_CONTACTS=100
-D MAX_GROUP_CHANNELS=8
-D BLE_PIN_CODE=123456
@@ -92,9 +92,9 @@ build_flags =
-D ENABLE_PRIVATE_KEY_IMPORT=1
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${faketec.build_src_filter} +<helpers/nrf52/SerialBLEInterface.cpp> +<../examples/companion_radio> +<helpers/ui/*.cpp>
build_src_filter = ${Faketec.build_src_filter} +<helpers/nrf52/SerialBLEInterface.cpp> +<../examples/companion_radio> +<helpers/ui/*.cpp>
lib_deps =
${faketec.lib_deps}
${Faketec.lib_deps}
adafruit/RTClib @ ^2.1.3
densaugeo/base64 @ ~1.4.0
@@ -110,7 +110,7 @@ build_flags = ${nrf52840_base.build_flags}
-D SX126X_CURRENT_LIMIT=130
-D SX126X_RX_BOOSTED_GAIN=1
build_src_filter = ${nrf52840_base.build_src_filter}
+<helpers/nrf52/FaketecBoard.cpp>
+<helpers/nrf52/PromicroBoard.cpp>
+<../variants/promicro>
[env:ProMicroLLCC68_Repeater]

View File

@@ -2,7 +2,7 @@
#include "target.h"
#include <helpers/ArduinoHelpers.h>
FaketecBoard board;
PromicroBoard board;
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);

View File

@@ -3,12 +3,12 @@
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/RadioLibWrappers.h>
#include <helpers/nrf52/FaketecBoard.h>
#include <helpers/nrf52/PromicroBoard.h>
#include <helpers/CustomSX1262Wrapper.h>
#include <helpers/CustomLLCC68Wrapper.h>
#include <helpers/AutoDiscoverRTCClock.h>
extern FaketecBoard board;
extern PromicroBoard board;
extern WRAPPER_CLASS radio_driver;
extern AutoDiscoverRTCClock rtc_clock;