Compare commits

...

3 Commits

Author SHA1 Message Date
Thomas Hooge 9af781318f Keyboard infos in readme and disabled unused LED task 2025-01-17 16:07:02 +01:00
Thomas Hooge 081a73d8f8 Set adapted defaults 2025-01-17 15:18:22 +01:00
Thomas Hooge ff867beb9d Improve SD card code 2025-01-17 15:04:47 +01:00
5 changed files with 77 additions and 30 deletions

View File

@ -10,7 +10,7 @@
"-DBOARD_HAS_PSRAM",
"-DARDUINO_ESP32S3_DEV",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_USB_CDC_ON_BOOT=0",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"
],

View File

@ -9,3 +9,27 @@ THIS BRANCH IS NOT INTENDED TO MERGE INTO "master"!
platformio.ini adapted to compile directly
Differences to OBP60
--------------------
- no GPS
- no RTC
- no LEDs
- no environment sensor
- no key lock
- no swipe
- only 5 keys
+ SD card interface
Keyboard
--------
Keycode Key Function
-------- ---------------- -------------------------
1 Menu key Key 1 of OBP60 (left)
2 Exit key Key 2 of OBP60
3 Jog-Dial press
9 Jog-Dial down Next page
10 Jog-Dial up Previous page

View File

@ -297,7 +297,7 @@
"name": "useRTC",
"label": "RTC Modul",
"type": "list",
"default": "DS1388",
"default": "off",
"description": "Use internal RTC module type [off|DS1388]",
"list": [
"off",
@ -312,7 +312,7 @@
"name": "useGPS",
"label": "GPS Sensor",
"type": "list",
"default": "ATGM336H",
"default": "off",
"description": "Use internal GPS module type [off|NEO-6M|NEO-M8N|ATGM336H]",
"list": [
"off",
@ -343,7 +343,7 @@
"name": "useEnvSensor",
"label": "Env. Sensor",
"type": "list",
"default": "BMP280",
"default": "off",
"description": "Use internal or external environment sensor via I2C bus [off|BME280|BMP280|BMP180|BMP085|HTU21|SHT21]",
"list": [
"off",
@ -573,6 +573,21 @@
"obp60":"true"
}
},
{
"name": "useSDCard",
"label": "SD Card",
"type": "boolean",
"default": "off",
"description": "Use internal SD card interface [off|on]",
"list": [
"off",
"on"
],
"category": "OBP60 Hardware",
"capabilities": {
"obp60":"true"
}
},
{
"name": "powerMode",
"label": "Power Mode",
@ -918,7 +933,7 @@
"name": "page1type",
"label": "Type",
"type": "list",
"default": "Voltage",
"default": "Clock",
"description": "Type of page for page 1",
"list": [
"BME280",
@ -1178,7 +1193,7 @@
"name": "page2type",
"label": "Type",
"type": "list",
"default": "WindRose",
"default": "Wind",
"description": "Type of page for page 2",
"list": [
"BME280",
@ -2676,7 +2691,7 @@
"name": "page8type",
"label": "Type",
"type": "list",
"default": "Clock",
"default": "Fluid",
"description": "Type of page for page 8",
"list": [
"BME280",

View File

@ -27,8 +27,6 @@
#include "OBP60QRWiFi.h" // Functions lib for WiFi QR code
#include "OBPSensorTask.h" // Functions lib for sensor data
#include "LedSpiTask.h"
// Global vars
bool initComplete = false; // Initialization complete
int taskRunCounter = 0; // Task couter for loop section
@ -37,6 +35,9 @@ int taskRunCounter = 0; // Task couter for loop section
//####################################################################################
void OBP60Init(GwApi *api){
GwLog *logger = api->getLogger();
GwConfigHandler *config = api->getConfig();
// Set a new device name and hidden the original name in the main config
String devicename = api->getConfig()->getConfigItem(api->getConfig()->deviceName,true)->asString();
api->getConfig()->setValue(GwConfigDefinitions::systemName, devicename, GwConfigInterface::ConfigType::HIDDEN);
@ -49,6 +50,31 @@ void OBP60Init(GwApi *api){
// Init hardware
hardwareInit(api);
String sdcard = config->getConfigItem(config->useSDCard, true)->asString();
if (sdcard == "on") {
setPortPin(OBP_POWER_SD, true); // Power on SD
delay(10);
SPIClass SD_SPI = SPIClass(HSPI);
SD_SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI);
if (SD.begin(SD_SPI_CS, SD_SPI, 80000000)) {
String sdtype = "unknown";
uint8_t cardType = SD.cardType();
switch (cardType) {
case CARD_MMC:
sdtype = "MMC";
break;
case CARD_SD:
sdtype = "SDSC";
break;
case CARD_SDHC:
sdtype = "SDHC";
break;
}
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
LOG_DEBUG(GwLog::LOG,"SD card type %s of size %d MB detected", sdtype, cardSize);
}
}
// Init power rail 5.0V
String powermode = api->getConfig()->getConfigItem(api->getConfig()->powerMode,true)->asString();
api->getLogger()->logDebug(GwLog::DEBUG,"Power Mode is: %s", powermode.c_str());
@ -292,7 +318,9 @@ void OBP60Task(GwApi *api){
// return;
GwLog *logger=api->getLogger();
GwConfigHandler *config=api->getConfig();
#ifdef HARDWARE_V21
startLedTask(api);
#endif
PageList allPages;
registerAllPages(allPages);
CommonData commonData;
@ -414,26 +442,6 @@ void OBP60Task(GwApi *api){
doImageRequest(api, &pageNumber, pages, request);
});
// SD-Card: init an check
SPI.begin(SD_SPI_CLK, SD_SPI_MISO, SD_SPI_MOSI, SD_SPI_CS);
if (SD.begin(SD_SPI_CS)) {
String sdtype = "unknown";
uint8_t cardType = SD.cardType();
switch (cardType) {
case CARD_MMC:
sdtype = "MMC";
break;
case CARD_SD:
sdtype = "SDSC";
break;
case CARD_SDHC:
sdtype = "SDHC";
break;
}
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
LOG_DEBUG(GwLog::DEBUG,"SD card type %s of size %d MB detected", sdtype, cardSize);
}
//now we have prepared the page data
//we start a separate task that will fetch our keys...
MyData allParameters;

View File

@ -41,7 +41,7 @@ lib_deps =
build_flags=
#https://thingpulse.com/usb-settings-for-logging-with-the-esp32-s3-in-platformio/?srsltid=AfmBOopGskbkr4GoeVkNlFaZXe_zXkLceKF6Rn-tmoXABCeAR2vWsdHL
# -D ARDUINO_USB_MODE=1 #0=OTG (to implement other external devices), 1=CDC (is a serial device)
-D ARDUINO_USB_CDC_ON_BOOT=0 #0=JTAG, 1=CDC (serial device)
# -D ARDUINO_USB_CDC_ON_BOOT=0 #0=JTAG, 1=CDC (serial device)
# -D CORE_DEBUG_LEVEL=1 #Debug level for CPU core via CDC (seral device)
# -D TIME=$UNIX_TIME #Set PC time for RTC (only settable via VSC)
-D DISABLE_DIAGNOSTIC_OUTPUT #Disable diagnostic output for GxEPD2 lib