Comments changed
This commit is contained in:
@@ -5,9 +5,7 @@
|
|||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
|
|
||||||
// =========================
|
|
||||||
// LoRa pins - LilyGO T3S3 SX1262
|
// LoRa pins - LilyGO T3S3 SX1262
|
||||||
// =========================
|
|
||||||
static const int PIN_LORA_SCK = 5;
|
static const int PIN_LORA_SCK = 5;
|
||||||
static const int PIN_LORA_MISO = 3;
|
static const int PIN_LORA_MISO = 3;
|
||||||
static const int PIN_LORA_MOSI = 6;
|
static const int PIN_LORA_MOSI = 6;
|
||||||
@@ -16,24 +14,17 @@ static const int PIN_LORA_RST = 8;
|
|||||||
static const int PIN_LORA_DIO1 = 33;
|
static const int PIN_LORA_DIO1 = 33;
|
||||||
static const int PIN_LORA_BUSY = 34;
|
static const int PIN_LORA_BUSY = 34;
|
||||||
|
|
||||||
// =========================
|
|
||||||
// Button - LilyGO T3S3
|
// Button - LilyGO T3S3
|
||||||
// BOOT button usually GPIO0, active low
|
|
||||||
// =========================
|
|
||||||
static const int PIN_BUTTON = 0;
|
static const int PIN_BUTTON = 0;
|
||||||
|
|
||||||
// =========================
|
|
||||||
// OLED pins - LilyGO T3S3 OLED
|
// OLED pins - LilyGO T3S3 OLED
|
||||||
// =========================
|
|
||||||
static const int OLED_SDA = 18;
|
static const int OLED_SDA = 18;
|
||||||
static const int OLED_SCL = 17;
|
static const int OLED_SCL = 17;
|
||||||
static const int OLED_ADDR = 0x3C;
|
static const int OLED_ADDR = 0x3C;
|
||||||
static const int SCREEN_WIDTH = 128;
|
static const int SCREEN_WIDTH = 128;
|
||||||
static const int SCREEN_HEIGHT = 64;
|
static const int SCREEN_HEIGHT = 64;
|
||||||
|
|
||||||
// =========================
|
|
||||||
// ACTIVE PROFILE - Shelly / custom LoRa
|
// ACTIVE PROFILE - Shelly / custom LoRa
|
||||||
// =========================
|
|
||||||
static const float LORA_FREQ_MHZ = 865.000;
|
static const float LORA_FREQ_MHZ = 865.000;
|
||||||
static const float LORA_BW_KHZ = 125.0;
|
static const float LORA_BW_KHZ = 125.0;
|
||||||
static const uint8_t LORA_SF = 12;
|
static const uint8_t LORA_SF = 12;
|
||||||
@@ -46,22 +37,16 @@ static const bool LORA_USE_LDO = false;
|
|||||||
static const bool LORA_USE_CRC = false;
|
static const bool LORA_USE_CRC = false;
|
||||||
static const bool LORA_EXPLICIT_HDR = true;
|
static const bool LORA_EXPLICIT_HDR = true;
|
||||||
|
|
||||||
// =========================
|
|
||||||
// Protocol
|
// Protocol
|
||||||
// =========================
|
|
||||||
static const String DEVICE_ID = "MG64738";
|
static const String DEVICE_ID = "MG64738";
|
||||||
static const String CMD_ON = "ON";
|
static const String CMD_ON = "ON";
|
||||||
static const String CMD_OFF = "OF";
|
static const String CMD_OFF = "OF";
|
||||||
|
|
||||||
// =========================
|
|
||||||
// Objects
|
// Objects
|
||||||
// =========================
|
|
||||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
|
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
|
||||||
SX1262 radio = new Module(PIN_LORA_CS, PIN_LORA_DIO1, PIN_LORA_RST, PIN_LORA_BUSY);
|
SX1262 radio = new Module(PIN_LORA_CS, PIN_LORA_DIO1, PIN_LORA_RST, PIN_LORA_BUSY);
|
||||||
|
|
||||||
// =========================
|
|
||||||
// Runtime state
|
// Runtime state
|
||||||
// =========================
|
|
||||||
bool outputState = true; // start with ON
|
bool outputState = true; // start with ON
|
||||||
bool lastButtonState = HIGH;
|
bool lastButtonState = HIGH;
|
||||||
unsigned long lastDebounceMs = 0;
|
unsigned long lastDebounceMs = 0;
|
||||||
@@ -70,9 +55,7 @@ int lastTxState = 0;
|
|||||||
|
|
||||||
static const unsigned long DEBOUNCE_MS = 60;
|
static const unsigned long DEBOUNCE_MS = 60;
|
||||||
|
|
||||||
// =========================
|
|
||||||
// Helpers
|
// Helpers
|
||||||
// =========================
|
|
||||||
String formatCR(uint8_t cr) {
|
String formatCR(uint8_t cr) {
|
||||||
return "4/" + String(cr);
|
return "4/" + String(cr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user