Petr Kracík
21 hours ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
17 additions and
2 deletions
-
src/helpers/esp32/ESPNOWRadio.cpp
-
src/helpers/esp32/SerialBLEInterface.cpp
-
src/helpers/ui/SSD1306Display.h
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
#include "ESPNOWRadio.h" |
|
|
|
#include <esp_now.h> |
|
|
|
#include <esp_mac.h> |
|
|
|
#include <WiFi.h> |
|
|
|
#include <esp_wifi.h> |
|
|
|
|
|
|
|
@ -11,12 +12,20 @@ static uint8_t rx_buf[256]; |
|
|
|
static uint8_t last_rx_len = 0; |
|
|
|
|
|
|
|
// callback when data is sent
|
|
|
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) |
|
|
|
static void OnDataSent(const esp_now_send_info_t *tx_info, esp_now_send_status_t status) { |
|
|
|
#else |
|
|
|
static void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) { |
|
|
|
#endif |
|
|
|
is_send_complete = true; |
|
|
|
ESPNOW_DEBUG_PRINTLN("Send Status: %d", (int)status); |
|
|
|
} |
|
|
|
|
|
|
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) |
|
|
|
static void OnDataRecv(const esp_now_recv_info_t *info, const uint8_t *data, int len) { |
|
|
|
#else |
|
|
|
static void OnDataRecv(const uint8_t *mac, const uint8_t *data, int len) { |
|
|
|
#endif |
|
|
|
ESPNOW_DEBUG_PRINTLN("Recv: len = %d", len); |
|
|
|
memcpy(rx_buf, data, len); |
|
|
|
last_rx_len = len; |
|
|
|
|
|
|
|
@ -29,7 +29,13 @@ void SerialBLEInterface::begin(const char* prefix, char* name, uint32_t pin_code |
|
|
|
BLEDevice::setMTU(MAX_FRAME_SIZE); |
|
|
|
|
|
|
|
BLESecurity sec; |
|
|
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) |
|
|
|
sec.setPassKey(true, pin_code); |
|
|
|
sec.setCapability(ESP_IO_CAP_OUT); |
|
|
|
sec.setInitEncryptionKey(ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK); |
|
|
|
#else |
|
|
|
sec.setStaticPIN(pin_code); |
|
|
|
#endif |
|
|
|
sec.setAuthenticationMode(ESP_LE_AUTH_REQ_SC_MITM_BOND); |
|
|
|
|
|
|
|
//BLEDevice::setPower(ESP_PWR_LVL_N8);
|
|
|
|
|
|
|
|
@ -8,11 +8,11 @@ |
|
|
|
#include <helpers/RefCountedDigitalPin.h> |
|
|
|
|
|
|
|
#ifndef PIN_OLED_RESET |
|
|
|
#define PIN_OLED_RESET 21 // Reset pin # (or -1 if sharing Arduino reset pin)
|
|
|
|
#define PIN_OLED_RESET -1 |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifndef DISPLAY_ADDRESS |
|
|
|
#define DISPLAY_ADDRESS 0x3C |
|
|
|
#define DISPLAY_ADDRESS 0x3C |
|
|
|
#endif |
|
|
|
|
|
|
|
class SSD1306Display : public DisplayDriver { |
|
|
|
|