mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
variants: Wio WM1110: Use common implementation of startOTAUpdate()
Signed-off-by: Frieder Schrempf <frieder@fris.de>
This commit is contained in:
parent
fa48d4fe81
commit
57fa1ba854
2 changed files with 4 additions and 46 deletions
|
|
@ -1,24 +1,9 @@
|
|||
#ifdef WIO_WM1110
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
#include <bluefruit.h>
|
||||
|
||||
#include "WioWM1110Board.h"
|
||||
|
||||
static BLEDfu bledfu;
|
||||
|
||||
static void connect_callback(uint16_t conn_handle) {
|
||||
(void)conn_handle;
|
||||
MESH_DEBUG_PRINTLN("BLE client connected");
|
||||
}
|
||||
|
||||
static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
||||
(void)conn_handle;
|
||||
(void)reason;
|
||||
|
||||
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
||||
}
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
|
||||
void WioWM1110Board::begin() {
|
||||
NRF52BoardDCDC::begin();
|
||||
|
|
@ -42,31 +27,5 @@ void WioWM1110Board::begin() {
|
|||
|
||||
delay(10);
|
||||
}
|
||||
|
||||
bool WioWM1110Board::startOTAUpdate(const char *id, char reply[]) {
|
||||
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
|
||||
Bluefruit.configPrphConn(92, BLE_GAP_EVENT_LENGTH_MIN, 16, 16);
|
||||
|
||||
Bluefruit.begin(1, 0);
|
||||
Bluefruit.setTxPower(4);
|
||||
Bluefruit.setName("WM1110_OTA");
|
||||
|
||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||
|
||||
bledfu.begin();
|
||||
|
||||
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
|
||||
Bluefruit.Advertising.addTxPower();
|
||||
Bluefruit.Advertising.addName();
|
||||
Bluefruit.Advertising.restartOnDisconnect(true);
|
||||
Bluefruit.Advertising.setInterval(32, 244);
|
||||
Bluefruit.Advertising.setFastTimeout(30);
|
||||
Bluefruit.Advertising.start(0);
|
||||
|
||||
strcpy(reply, "OK - started");
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,9 @@
|
|||
#endif
|
||||
#define Serial Serial1
|
||||
|
||||
class WioWM1110Board : public NRF52BoardDCDC {
|
||||
class WioWM1110Board : public NRF52BoardDCDC, public NRF52BoardOTA {
|
||||
public:
|
||||
WioWM1110Board() : NRF52BoardOTA("WM1110_OTA") {}
|
||||
void begin();
|
||||
|
||||
#if defined(LED_GREEN)
|
||||
|
|
@ -37,8 +38,6 @@ public:
|
|||
return "Seeed Wio WM1110";
|
||||
}
|
||||
|
||||
bool startOTAUpdate(const char* id, char reply[]) override;
|
||||
|
||||
void enableSensorPower(bool enable) {
|
||||
digitalWrite(SENSOR_POWER_PIN, enable ? HIGH : LOW);
|
||||
if (enable) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue