Merge branch 'norbert-walter:master' into master
This commit is contained in:
commit
1a43fe29e9
|
@ -1,9 +1,6 @@
|
||||||
#ifdef BOARD_OBP60S3
|
#ifdef BOARD_OBP60S3
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#define FASTLED_ALL_PINS_HARDWARE_SPI
|
|
||||||
#define FASTLED_ESP32_SPI_BUS FSPI
|
|
||||||
#define FASTLED_ESP32_FLASH_LOCK 1
|
|
||||||
#include <PCF8574.h> // Driver for PCF8574 output modul from Horter
|
#include <PCF8574.h> // Driver for PCF8574 output modul from Horter
|
||||||
#include <Wire.h> // I2C
|
#include <Wire.h> // I2C
|
||||||
#include <RTClib.h> // Driver for DS1388 RTC
|
#include <RTClib.h> // Driver for DS1388 RTC
|
||||||
|
@ -472,6 +469,7 @@ void generatorGraphic(uint x, uint y, int pcolor, int bcolor){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to handle HTTP image request
|
// Function to handle HTTP image request
|
||||||
|
// http://192.168.15.1/api/user/OBP60Task/screenshot
|
||||||
void doImageRequest(GwApi *api, int *pageno, const PageStruct pages[MAX_PAGE_NUMBER], AsyncWebServerRequest *request) {
|
void doImageRequest(GwApi *api, int *pageno, const PageStruct pages[MAX_PAGE_NUMBER], AsyncWebServerRequest *request) {
|
||||||
GwLog *logger = api->getLogger();
|
GwLog *logger = api->getLogger();
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "OBP60Hardware.h"
|
#include "OBP60Hardware.h"
|
||||||
#define FASTLED_ALL_PINS_HARDWARE_SPI
|
|
||||||
#define FASTLED_ESP32_SPI_BUS FSPI
|
|
||||||
#define FASTLED_ESP32_FLASH_LOCK 1
|
|
||||||
#include "LedSpiTask.h"
|
#include "LedSpiTask.h"
|
||||||
#include <GxEPD2_BW.h> // E-paper lib V2
|
#include <GxEPD2_BW.h> // E-paper lib V2
|
||||||
#include <Adafruit_FRAM_I2C.h> // I2C FRAM
|
#include <Adafruit_FRAM_I2C.h> // I2C FRAM
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
#define TONE3 3500 // 3500Hz
|
#define TONE3 3500 // 3500Hz
|
||||||
#define TONE4 4000 // 4000Hz
|
#define TONE4 4000 // 4000Hz
|
||||||
// Analog Input
|
// Analog Input
|
||||||
#define OBP_ANALOG0 4 // Analog input for voltage power supplay
|
#define OBP_ANALOG0 4 // Analog input for voltage power supply
|
||||||
#define MIN_VOLTAGE 10.0 // Min voltage for under voltage detection (then goto deep sleep)
|
#define MIN_VOLTAGE 10.0 // Min voltage for under voltage detection (then goto deep sleep)
|
||||||
#define POWER_FAIL_TIME 2 // in [ms] Accept min voltage until 2 x 1ms (for under voltage gaps by engine start)
|
#define POWER_FAIL_TIME 2 // in [ms] Accept min voltage until 2 x 1ms (for under voltage gaps by engine start)
|
||||||
// Touch buttons
|
// Touch buttons
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
#define NUM_FLASH_LED 1 // Number of flash LED
|
#define NUM_FLASH_LED 1 // Number of flash LED
|
||||||
#define OBP_FLASH_LED 7 // GPIO port
|
#define OBP_FLASH_LED 7 // GPIO port
|
||||||
// Backlight LEDs (6x WS2812B)
|
// Backlight LEDs (6x WS2812B)
|
||||||
#define NUM_BACKLIGHT_LED 6 // Numebr of Backlight LEDs
|
#define NUM_BACKLIGHT_LED 6 // Number of Backlight LEDs
|
||||||
#define OBP_BACKLIGHT_LED 15 // GPIO port
|
#define OBP_BACKLIGHT_LED 15 // GPIO port
|
||||||
// Power Rail
|
// Power Rail
|
||||||
#define OBP_POWER_50 5 // 5.0V power rail
|
#define OBP_POWER_50 5 // 5.0V power rail
|
||||||
|
|
|
@ -456,7 +456,7 @@ void sensorTask(void *param){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send supplay voltage value all 1s
|
// Send supply voltage value all 1s
|
||||||
if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){
|
if(millis() > starttime5 + 1000 && String(powsensor1) == "off"){
|
||||||
starttime5 = millis();
|
starttime5 = millis();
|
||||||
sensors.batteryVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20
|
sensors.batteryVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // Vin = 1/20
|
||||||
|
|
|
@ -246,7 +246,7 @@ void underVoltageDetection(GwApi *api, CommonData &common){
|
||||||
// Read settings
|
// Read settings
|
||||||
float vslope = uint(api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asFloat());
|
float vslope = uint(api->getConfig()->getConfigItem(api->getConfig()->vSlope,true)->asFloat());
|
||||||
float voffset = uint(api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asFloat());
|
float voffset = uint(api->getConfig()->getConfigItem(api->getConfig()->vOffset,true)->asFloat());
|
||||||
// Read supplay voltage
|
// Read supply voltage
|
||||||
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // V = 1/20 * Vin
|
float actVoltage = (float(analogRead(OBP_ANALOG0)) * 3.3 / 4096 + 0.17) * 20; // V = 1/20 * Vin
|
||||||
actVoltage = actVoltage * vslope + voffset;
|
actVoltage = actVoltage * vslope + voffset;
|
||||||
if(actVoltage < MIN_VOLTAGE){
|
if(actVoltage < MIN_VOLTAGE){
|
||||||
|
@ -394,6 +394,8 @@ void OBP60Task(GwApi *api){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display screenshot handler for HTTP request
|
||||||
|
// http://192.168.15.1/api/user/OBP60Task/screenshot
|
||||||
api->registerRequestHandler("screenshot", [api, &pageNumber, pages](AsyncWebServerRequest *request) {
|
api->registerRequestHandler("screenshot", [api, &pageNumber, pages](AsyncWebServerRequest *request) {
|
||||||
doImageRequest(api, &pageNumber, pages, request);
|
doImageRequest(api, &pageNumber, pages, request);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue