mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 19:26:37 +00:00
commit
cd77945e28
@ -96,8 +96,11 @@ Arduino_ST7789::Arduino_ST7789(int8_t dc, int8_t rst, int8_t cs, int8_t bp)
|
|||||||
|
|
||||||
void Arduino_ST7789::DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font) {
|
void Arduino_ST7789::DisplayInit(int8_t p,int8_t size,int8_t rot,int8_t font) {
|
||||||
setRotation(rot);
|
setRotation(rot);
|
||||||
//invertDisplay(false);
|
if (_width==320 || _height==320) {
|
||||||
invertDisplay(true);
|
invertDisplay(false);
|
||||||
|
} else {
|
||||||
|
invertDisplay(true);
|
||||||
|
}
|
||||||
//setTextWrap(false); // Allow text to run off edges
|
//setTextWrap(false); // Allow text to run off edges
|
||||||
//cp437(true);
|
//cp437(true);
|
||||||
setTextFont(font&3);
|
setTextFont(font&3);
|
||||||
|
@ -209,51 +209,17 @@ void alt_eeprom_readBytes(uint32_t adr, uint32_t len, uint8_t *buf) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(LITTLEFS_SCRIPT_SIZE) || (USE_SCRIPT_FATFS==-1)
|
#if USE_SCRIPT_FATFS==-1
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
#include "FS.h"
|
#include "FS.h"
|
||||||
#ifdef LITTLEFS_SCRIPT_SIZE
|
|
||||||
#include "SPIFFS.h"
|
|
||||||
#else
|
|
||||||
#include "FFat.h"
|
#include "FFat.h"
|
||||||
//#include <LittleFS.h>
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
#endif
|
#endif
|
||||||
FS *fsp;
|
FS *fsp;
|
||||||
#endif // LITTLEFS_SCRIPT_SIZE
|
#endif // LITTLEFS_SCRIPT_SIZE
|
||||||
|
|
||||||
|
//extern FS *ufsp;
|
||||||
#ifdef LITTLEFS_SCRIPT_SIZE
|
|
||||||
void SaveFile(const char *name, const uint8_t *buf, uint32_t len) {
|
|
||||||
File file = fsp->open(name, "w");
|
|
||||||
if (!file) return;
|
|
||||||
file.write(buf, len);
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t fs_mounted=0;
|
|
||||||
|
|
||||||
void LoadFile(const char *name, uint8_t *buf, uint32_t len) {
|
|
||||||
if (!fs_mounted) {
|
|
||||||
#ifdef ESP32
|
|
||||||
if (!SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED)) {
|
|
||||||
#else
|
|
||||||
if (!fsp->begin()) {
|
|
||||||
#endif
|
|
||||||
//Serial.println("SPIFFS Mount Failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fs_mounted=1;
|
|
||||||
}
|
|
||||||
File file = fsp->open(name, "r");
|
|
||||||
if (!file) return;
|
|
||||||
file.read(buf, len);
|
|
||||||
file.close();
|
|
||||||
}
|
|
||||||
#endif // LITTLEFS_SCRIPT_SIZE
|
|
||||||
|
|
||||||
// offsets epoch readings by 1.1.2019 00:00:00 to fit into float with second resolution
|
// offsets epoch readings by 1.1.2019 00:00:00 to fit into float with second resolution
|
||||||
#define EPOCH_OFFSET 1546300800
|
#define EPOCH_OFFSET 1546300800
|
||||||
@ -266,7 +232,10 @@ enum {SCRIPT_LOGLEVEL=1,SCRIPT_TELEPERIOD,SCRIPT_EVENT_HANDLED};
|
|||||||
#if USE_SCRIPT_FATFS>=0
|
#if USE_SCRIPT_FATFS>=0
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
|
#include <FS.h>
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
|
#include "FFat.h"
|
||||||
FS *fsp;
|
FS *fsp;
|
||||||
#else
|
#else
|
||||||
SDClass *fsp;
|
SDClass *fsp;
|
||||||
@ -996,6 +965,10 @@ char *script;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// init file system
|
||||||
|
//#ifndef USE_UFILESYS
|
||||||
|
#if 1
|
||||||
|
|
||||||
#ifdef USE_SCRIPT_FATFS
|
#ifdef USE_SCRIPT_FATFS
|
||||||
if (!glob_script_mem.script_sd_found) {
|
if (!glob_script_mem.script_sd_found) {
|
||||||
|
|
||||||
@ -1024,6 +997,10 @@ char *script;
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
fsp = ufsp;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if SCRIPT_DEBUG>0
|
#if SCRIPT_DEBUG>0
|
||||||
ClaimSerial();
|
ClaimSerial();
|
||||||
SetSerialBaudrate(9600);
|
SetSerialBaudrate(9600);
|
||||||
@ -1757,6 +1734,7 @@ char *isvar(char *lp, uint8_t *vtype, struct T_INDEX *tind, float *fp, char *sp,
|
|||||||
fvar = Get_MFilter(index);
|
fvar = Get_MFilter(index);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (ja) continue;
|
||||||
fvar = glob_script_mem.fvars[index];
|
fvar = glob_script_mem.fvars[index];
|
||||||
}
|
}
|
||||||
if (nres) fvar = -fvar;
|
if (nres) fvar = -fvar;
|
||||||
@ -5319,11 +5297,6 @@ void SaveScript(void) {
|
|||||||
}
|
}
|
||||||
#endif // USE_SCRIPT_FATFS
|
#endif // USE_SCRIPT_FATFS
|
||||||
|
|
||||||
#ifdef LITTLEFS_SCRIPT_SIZE
|
|
||||||
if (glob_script_mem.flags&1) {
|
|
||||||
SaveFile("/script.txt", (uint8_t*)glob_script_mem.script_ram, LITTLEFS_SCRIPT_SIZE);
|
|
||||||
}
|
|
||||||
#endif // LITTLEFS_SCRIPT_SIZE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptSaveSettings(void) {
|
void ScriptSaveSettings(void) {
|
||||||
@ -7679,7 +7652,8 @@ bool Xdrv10(uint8_t function)
|
|||||||
char *sprt;
|
char *sprt;
|
||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case FUNC_PRE_INIT:
|
//case FUNC_PRE_INIT:
|
||||||
|
case FUNC_INIT:
|
||||||
// set defaults to rules memory
|
// set defaults to rules memory
|
||||||
//bitWrite(Settings.rule_enabled,0,0);
|
//bitWrite(Settings.rule_enabled,0,0);
|
||||||
glob_script_mem.script_ram = Settings.rules[0];
|
glob_script_mem.script_ram = Settings.rules[0];
|
||||||
@ -7771,8 +7745,6 @@ bool Xdrv10(uint8_t function)
|
|||||||
#else
|
#else
|
||||||
// flash file system
|
// flash file system
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
//fsp = &SPIFFS;
|
|
||||||
//if (SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED)) {
|
|
||||||
fsp = &FFat;
|
fsp = &FFat;
|
||||||
if (FFat.begin(true)) {
|
if (FFat.begin(true)) {
|
||||||
#else
|
#else
|
||||||
@ -7782,6 +7754,7 @@ bool Xdrv10(uint8_t function)
|
|||||||
#endif // ESP
|
#endif // ESP
|
||||||
|
|
||||||
#endif // USE_SCRIPT_FATFS>=0
|
#endif // USE_SCRIPT_FATFS>=0
|
||||||
|
|
||||||
Script_AddLog_P(LOG_LEVEL_INFO,PSTR("FATFS mount OK!"));
|
Script_AddLog_P(LOG_LEVEL_INFO,PSTR("FATFS mount OK!"));
|
||||||
|
|
||||||
//fsp->dateTimeCallback(dateTime);
|
//fsp->dateTimeCallback(dateTime);
|
||||||
@ -7810,31 +7783,6 @@ bool Xdrv10(uint8_t function)
|
|||||||
#endif // USE_SCRIPT_FATFS
|
#endif // USE_SCRIPT_FATFS
|
||||||
|
|
||||||
|
|
||||||
#ifdef LITTLEFS_SCRIPT_SIZE
|
|
||||||
|
|
||||||
#ifdef ESP32
|
|
||||||
// spiffs on esp32
|
|
||||||
fsp = &SPIFFS;
|
|
||||||
//esp32_part = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,ESP_PARTITION_SUBTYPE_DATA_SPIFFS,NULL);
|
|
||||||
//Serial.printf("address %d - %d - %s\n",esp32_part->address,esp32_part->size, esp32_part->label);
|
|
||||||
#else
|
|
||||||
// lfs on esp8266
|
|
||||||
fsp = &LittleFS;
|
|
||||||
#endif //ESP32
|
|
||||||
char *script;
|
|
||||||
script = (char*)calloc(LITTLEFS_SCRIPT_SIZE + 4, 1);
|
|
||||||
if (!script) break;
|
|
||||||
LoadFile("/script.txt", (uint8_t*)script, LITTLEFS_SCRIPT_SIZE);
|
|
||||||
|
|
||||||
glob_script_mem.script_ram = script;
|
|
||||||
glob_script_mem.script_size = LITTLEFS_SCRIPT_SIZE;
|
|
||||||
script[LITTLEFS_SCRIPT_SIZE-1] = 0;
|
|
||||||
// use rules storage for permanent vars
|
|
||||||
glob_script_mem.script_pram = (uint8_t*)Settings.rules[0];
|
|
||||||
glob_script_mem.script_pram_size = MAX_SCRIPT_SIZE;
|
|
||||||
glob_script_mem.flags = 1;
|
|
||||||
#endif // LITTLEFS_SCRIPT_SIZE
|
|
||||||
|
|
||||||
// a valid script MUST start with >D
|
// a valid script MUST start with >D
|
||||||
if (glob_script_mem.script_ram[0]!='>' && glob_script_mem.script_ram[1]!='D') {
|
if (glob_script_mem.script_ram[0]!='>' && glob_script_mem.script_ram[1]!='D') {
|
||||||
// clr all
|
// clr all
|
||||||
@ -7852,8 +7800,8 @@ bool Xdrv10(uint8_t function)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bitRead(Settings.rule_enabled, 0)) Init_Scripter();
|
if (bitRead(Settings.rule_enabled, 0)) Init_Scripter();
|
||||||
break;
|
// break;
|
||||||
case FUNC_INIT:
|
//case FUNC_INIT:
|
||||||
if (bitRead(Settings.rule_enabled, 0)) {
|
if (bitRead(Settings.rule_enabled, 0)) {
|
||||||
Run_Scripter(">B\n", 3, 0);
|
Run_Scripter(">B\n", 3, 0);
|
||||||
fast_script = Run_Scripter(">F", -2, 0);
|
fast_script = Run_Scripter(">F", -2, 0);
|
||||||
|
@ -45,6 +45,10 @@
|
|||||||
|
|
||||||
// currently fixed
|
// currently fixed
|
||||||
#define BACKPLANE_PIN 2
|
#define BACKPLANE_PIN 2
|
||||||
|
#ifdef USE_LANBON_L8
|
||||||
|
#undef BACKPLANE_PIN
|
||||||
|
#define BACKPLANE_PIN 5
|
||||||
|
#endif // USE_LANBON_L8
|
||||||
|
|
||||||
extern uint8_t *buffer;
|
extern uint8_t *buffer;
|
||||||
extern uint8_t color_type;
|
extern uint8_t color_type;
|
||||||
@ -126,6 +130,12 @@ void ST7789_InitDriver(void) {
|
|||||||
// start digitizer with fixed adress and pins for esp32
|
// start digitizer with fixed adress and pins for esp32
|
||||||
#define SDA_2 23
|
#define SDA_2 23
|
||||||
#define SCL_2 32
|
#define SCL_2 32
|
||||||
|
#ifdef USE_LANBON_L8
|
||||||
|
#undef SDA_2
|
||||||
|
#undef SCL_2
|
||||||
|
#define SDA_2 4
|
||||||
|
#define SCL_2 0
|
||||||
|
#endif // USE_LANBON_L8
|
||||||
Wire1.begin(SDA_2, SCL_2, 400000);
|
Wire1.begin(SDA_2, SCL_2, 400000);
|
||||||
Touch_Init(Wire1);
|
Touch_Init(Wire1);
|
||||||
#endif // USE_FT5206
|
#endif // USE_FT5206
|
||||||
|
@ -264,7 +264,7 @@ bool HxCommand(void)
|
|||||||
char item[33];
|
char item[33];
|
||||||
dtostrfd((float)Settings.weight_item / 10, 1, item);
|
dtostrfd((float)Settings.weight_item / 10, 1, item);
|
||||||
Response_P(PSTR("{\"Sensor34\":{\"" D_JSON_WEIGHT_REF "\":%d,\"" D_JSON_WEIGHT_CAL "\":%d,\"" D_JSON_WEIGHT_MAX "\":%d,\""
|
Response_P(PSTR("{\"Sensor34\":{\"" D_JSON_WEIGHT_REF "\":%d,\"" D_JSON_WEIGHT_CAL "\":%d,\"" D_JSON_WEIGHT_MAX "\":%d,\""
|
||||||
D_JSON_WEIGHT_ITEM "\":%s,\"" D_JSON_WEIGHT_CHANGE "\":%s,\"" D_JSON_WEIGHT_DELTA "\":%d}}"),
|
D_JSON_WEIGHT_ITEM "\":%s,\"" D_JSON_WEIGHT_CHANGE "\":\"%s\",\"" D_JSON_WEIGHT_DELTA "\":%d}}"),
|
||||||
Settings.weight_reference, Settings.weight_calibration, Settings.weight_max * 1000,
|
Settings.weight_reference, Settings.weight_calibration, Settings.weight_max * 1000,
|
||||||
item, GetStateText(Settings.SensorBits1.hx711_json_weight_change), Settings.weight_change);
|
item, GetStateText(Settings.SensorBits1.hx711_json_weight_change), Settings.weight_change);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user