mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-25 11:46:31 +00:00
Merge branch 'arendst:development' into development
This commit is contained in:
commit
0145d29a50
6
.gitignore
vendored
6
.gitignore
vendored
@ -19,14 +19,10 @@ data
|
|||||||
unpacked_fs
|
unpacked_fs
|
||||||
tasmota/user_config_override.h
|
tasmota/user_config_override.h
|
||||||
build
|
build
|
||||||
build_output
|
build_output/*
|
||||||
firmware.map
|
firmware.map
|
||||||
firmware.asm
|
firmware.asm
|
||||||
tasmota/tasmota.ino.cpp
|
tasmota/tasmota.ino.cpp
|
||||||
tasmota*.bin
|
|
||||||
tasmota*.bin.gz
|
|
||||||
tasmota*.map
|
|
||||||
tasmota*.map.gz
|
|
||||||
platformio_override.ini
|
platformio_override.ini
|
||||||
platformio_tasmota_cenv.ini
|
platformio_tasmota_cenv.ini
|
||||||
|
|
||||||
|
46
boards/esp32_4M_2APP.json
Normal file
46
boards/esp32_4M_2APP.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"arduino":{
|
||||||
|
"ldscript": "esp32_out.ld"
|
||||||
|
},
|
||||||
|
"core": "esp32",
|
||||||
|
"extra_flags": "-DARDUINO_ESP32_DEV -DBOARD_HAS_PSRAM -DARDUINO_USB_CDC_ON_BOOT=0 -DESP32_4M",
|
||||||
|
"f_cpu": "80000000L",
|
||||||
|
"f_flash": "40000000L",
|
||||||
|
"flash_mode": "dout",
|
||||||
|
"mcu": "esp32",
|
||||||
|
"variant": "esp32",
|
||||||
|
"partitions": "esp32_partition_app2880k_spiffs320k.csv"
|
||||||
|
},
|
||||||
|
"connectivity": [
|
||||||
|
"wifi",
|
||||||
|
"bluetooth",
|
||||||
|
"ethernet",
|
||||||
|
"can"
|
||||||
|
],
|
||||||
|
"debug": {
|
||||||
|
"openocd_target": "esp32.cfg"
|
||||||
|
},
|
||||||
|
"frameworks": [
|
||||||
|
"arduino",
|
||||||
|
"espidf"
|
||||||
|
],
|
||||||
|
"name": "Espressif Generic ESP32 4M Flash, Tasmota 2880k Code/OTA, 320k FS",
|
||||||
|
"upload": {
|
||||||
|
"arduino": {
|
||||||
|
"flash_extra_images": [
|
||||||
|
[
|
||||||
|
"0x2E0000",
|
||||||
|
"variants/tasmota/tasmota32-minicustom.bin"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"flash_size": "4MB",
|
||||||
|
"maximum_ram_size": 327680,
|
||||||
|
"maximum_size": 4194304,
|
||||||
|
"require_upload_port": true,
|
||||||
|
"speed": 460800
|
||||||
|
},
|
||||||
|
"url": "https://en.wikipedia.org/wiki/ESP32",
|
||||||
|
"vendor": "Espressif"
|
||||||
|
}
|
6
esp32_partition_app2880k_spiffs320k.csv
Normal file
6
esp32_partition_app2880k_spiffs320k.csv
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
|
nvs, data, nvs, 0x9000, 0x5000,
|
||||||
|
otadata, data, ota, 0xe000, 0x2000,
|
||||||
|
app0, app, ota_0, 0x10000, 0x2D0000,
|
||||||
|
factory, app, factory, 0x2E0000,0xD0000,
|
||||||
|
spiffs, data, spiffs, 0x3B0000,0x50000,
|
|
@ -214,8 +214,10 @@ static void save_proto_table(bvm *vm, void *fp, bproto *proto)
|
|||||||
{
|
{
|
||||||
bproto **p = proto->ptab, **end;
|
bproto **p = proto->ptab, **end;
|
||||||
save_long(fp, proto->nproto); /* proto count */
|
save_long(fp, proto->nproto); /* proto count */
|
||||||
for (end = p + proto->nproto; p < end; ++p) {
|
if (p) {
|
||||||
save_proto(vm, fp, *p);
|
for (end = p + proto->nproto; p < end; ++p) {
|
||||||
|
save_proto(vm, fp, *p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,9 +225,11 @@ static void save_upvals(void *fp, bproto *proto)
|
|||||||
{
|
{
|
||||||
bupvaldesc *uv = proto->upvals, *end;
|
bupvaldesc *uv = proto->upvals, *end;
|
||||||
save_byte(fp, proto->nupvals); /* upvals count */
|
save_byte(fp, proto->nupvals); /* upvals count */
|
||||||
for (end = uv + proto->nupvals; uv < end; ++uv) {
|
if (uv) {
|
||||||
save_byte(fp, uv->instack);
|
for (end = uv + proto->nupvals; uv < end; ++uv) {
|
||||||
save_byte(fp, uv->idx);
|
save_byte(fp, uv->instack);
|
||||||
|
save_byte(fp, uv->idx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,7 +496,7 @@ static void load_constant(bvm *vm, void *fp, bproto *proto, int version)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_proto_table(bvm *vm, void *fp, bproto *proto, int version)
|
static void load_proto_table(bvm *vm, void *fp, bproto *proto, int info, int version)
|
||||||
{
|
{
|
||||||
int size = (int)load_long(fp); /* proto count */
|
int size = (int)load_long(fp); /* proto count */
|
||||||
if (size) {
|
if (size) {
|
||||||
@ -501,7 +505,7 @@ static void load_proto_table(bvm *vm, void *fp, bproto *proto, int version)
|
|||||||
proto->ptab = p;
|
proto->ptab = p;
|
||||||
proto->nproto = size;
|
proto->nproto = size;
|
||||||
while (size--) {
|
while (size--) {
|
||||||
load_proto(vm, fp, p++, -1, version);
|
load_proto(vm, fp, p++, info, version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,7 +542,7 @@ static bbool load_proto(bvm *vm, void *fp, bproto **proto, int info, int version
|
|||||||
}
|
}
|
||||||
load_bytecode(vm, fp, *proto, info);
|
load_bytecode(vm, fp, *proto, info);
|
||||||
load_constant(vm, fp, *proto, version);
|
load_constant(vm, fp, *proto, version);
|
||||||
load_proto_table(vm, fp, *proto, version);
|
load_proto_table(vm, fp, *proto, info, version);
|
||||||
load_upvals(vm, fp, *proto);
|
load_upvals(vm, fp, *proto);
|
||||||
return btrue;
|
return btrue;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "be_map.h"
|
#include "be_map.h"
|
||||||
#include "be_gc.h"
|
#include "be_gc.h"
|
||||||
#include "be_class.h"
|
#include "be_class.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define global(vm) ((vm)->gbldesc.global)
|
#define global(vm) ((vm)->gbldesc.global)
|
||||||
#define builtin(vm) ((vm)->gbldesc.builtin)
|
#define builtin(vm) ((vm)->gbldesc.builtin)
|
||||||
|
@ -1968,7 +1968,7 @@ be_local_closure(lvh_obj_get_obj, /* name */
|
|||||||
********************************************************************/
|
********************************************************************/
|
||||||
be_local_closure(lvh_obj_get_action, /* name */
|
be_local_closure(lvh_obj_get_action, /* name */
|
||||||
be_nested_proto(
|
be_nested_proto(
|
||||||
2, /* nstack */
|
3, /* nstack */
|
||||||
1, /* argc */
|
1, /* argc */
|
||||||
2, /* varg */
|
2, /* varg */
|
||||||
0, /* has upvals */
|
0, /* has upvals */
|
||||||
@ -1976,14 +1976,19 @@ be_local_closure(lvh_obj_get_action, /* name */
|
|||||||
0, /* has sup protos */
|
0, /* has sup protos */
|
||||||
NULL, /* no sub protos */
|
NULL, /* no sub protos */
|
||||||
1, /* has constants */
|
1, /* has constants */
|
||||||
( &(const bvalue[ 1]) { /* constants */
|
( &(const bvalue[ 2]) { /* constants */
|
||||||
/* K0 */ be_nested_str_literal("_action"),
|
/* K0 */ be_nested_str_literal("_action"),
|
||||||
|
/* K1 */ be_nested_str_literal(""),
|
||||||
}),
|
}),
|
||||||
be_str_literal("get_action"),
|
be_str_literal("get_action"),
|
||||||
&be_const_str_solidified,
|
&be_const_str_solidified,
|
||||||
( &(const binstruction[ 2]) { /* code */
|
( &(const binstruction[ 6]) { /* code */
|
||||||
0x88040100, // 0000 GETMBR R1 R0 K0
|
0x88040100, // 0000 GETMBR R1 R0 K0
|
||||||
0x80040200, // 0001 RET 1 R1
|
0x78060001, // 0001 JMPF R1 #0004
|
||||||
|
0x5C080200, // 0002 MOVE R2 R1
|
||||||
|
0x70020000, // 0003 JMP #0005
|
||||||
|
0x58080001, // 0004 LDCONST R2 K1
|
||||||
|
0x80040400, // 0005 RET 1 R2
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -3438,66 +3443,66 @@ be_local_closure(lvh_obj_event_cb, /* name */
|
|||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
1, /* has constants */
|
1, /* has constants */
|
||||||
( &(const bvalue[16]) { /* constants */
|
( &(const bvalue[17]) { /* constants */
|
||||||
/* K0 */ be_nested_str_literal("_page"),
|
/* K0 */ be_nested_str_literal("_page"),
|
||||||
/* K1 */ be_nested_str_literal("_oh"),
|
/* K1 */ be_nested_str_literal("_oh"),
|
||||||
/* K2 */ be_nested_str_literal("code"),
|
/* K2 */ be_nested_str_literal("code"),
|
||||||
/* K3 */ be_nested_str_literal("action"),
|
/* K3 */ be_nested_str_literal("action"),
|
||||||
/* K4 */ be_nested_str_literal("lv"),
|
/* K4 */ be_nested_str_literal(""),
|
||||||
/* K5 */ be_nested_str_literal("EVENT_CLICKED"),
|
/* K5 */ be_nested_str_literal("lv"),
|
||||||
/* K6 */ be_nested_str_literal("tasmota"),
|
/* K6 */ be_nested_str_literal("EVENT_CLICKED"),
|
||||||
/* K7 */ be_nested_str_literal("set_timer"),
|
/* K7 */ be_nested_str_literal("tasmota"),
|
||||||
/* K8 */ be_const_int(0),
|
/* K8 */ be_nested_str_literal("set_timer"),
|
||||||
/* K9 */ be_nested_str_literal("_event_map"),
|
/* K9 */ be_const_int(0),
|
||||||
/* K10 */ be_nested_str_literal("find"),
|
/* K10 */ be_nested_str_literal("_event_map"),
|
||||||
/* K11 */ be_nested_str_literal("string"),
|
/* K11 */ be_nested_str_literal("find"),
|
||||||
/* K12 */ be_nested_str_literal("format"),
|
/* K12 */ be_nested_str_literal("string"),
|
||||||
/* K13 */ be_nested_str_literal("{\"hasp\":{\"p%ib%i\":\"%s\"}}"),
|
/* K13 */ be_nested_str_literal("format"),
|
||||||
/* K14 */ be_nested_str_literal("_page_id"),
|
/* K14 */ be_nested_str_literal("{\"hasp\":{\"p%ib%i\":\"%s\"}}"),
|
||||||
/* K15 */ be_nested_str_literal("id"),
|
/* K15 */ be_nested_str_literal("_page_id"),
|
||||||
|
/* K16 */ be_nested_str_literal("id"),
|
||||||
}),
|
}),
|
||||||
be_str_literal("event_cb"),
|
be_str_literal("event_cb"),
|
||||||
&be_const_str_solidified,
|
&be_const_str_solidified,
|
||||||
( &(const binstruction[39]) { /* code */
|
( &(const binstruction[38]) { /* code */
|
||||||
0x88080100, // 0000 GETMBR R2 R0 K0
|
0x88080100, // 0000 GETMBR R2 R0 K0
|
||||||
0x88080501, // 0001 GETMBR R2 R2 K1
|
0x88080501, // 0001 GETMBR R2 R2 K1
|
||||||
0x880C0302, // 0002 GETMBR R3 R1 K2
|
0x880C0302, // 0002 GETMBR R3 R1 K2
|
||||||
0x88100103, // 0003 GETMBR R4 R0 K3
|
0x88100103, // 0003 GETMBR R4 R0 K3
|
||||||
0x4C140000, // 0004 LDNIL R5
|
0x20100904, // 0004 NE R4 R4 K4
|
||||||
0x20100805, // 0005 NE R4 R4 R5
|
0x78120008, // 0005 JMPF R4 #000F
|
||||||
0x78120008, // 0006 JMPF R4 #0010
|
0xB8120A00, // 0006 GETNGBL R4 K5
|
||||||
0xB8120800, // 0007 GETNGBL R4 K4
|
0x88100906, // 0007 GETMBR R4 R4 K6
|
||||||
0x88100905, // 0008 GETMBR R4 R4 K5
|
0x1C100604, // 0008 EQ R4 R3 R4
|
||||||
0x1C100604, // 0009 EQ R4 R3 R4
|
0x78120004, // 0009 JMPF R4 #000F
|
||||||
0x78120004, // 000A JMPF R4 #0010
|
0xB8120E00, // 000A GETNGBL R4 K7
|
||||||
0xB8120C00, // 000B GETNGBL R4 K6
|
0x8C100908, // 000B GETMET R4 R4 K8
|
||||||
0x8C100907, // 000C GETMET R4 R4 K7
|
0x58180009, // 000C LDCONST R6 K9
|
||||||
0x58180008, // 000D LDCONST R6 K8
|
0x841C0000, // 000D CLOSURE R7 P0
|
||||||
0x841C0000, // 000E CLOSURE R7 P0
|
0x7C100600, // 000E CALL R4 3
|
||||||
0x7C100600, // 000F CALL R4 3
|
0x8810010A, // 000F GETMBR R4 R0 K10
|
||||||
0x88100109, // 0010 GETMBR R4 R0 K9
|
0x8C10090B, // 0010 GETMET R4 R4 K11
|
||||||
0x8C10090A, // 0011 GETMET R4 R4 K10
|
0x5C180600, // 0011 MOVE R6 R3
|
||||||
0x5C180600, // 0012 MOVE R6 R3
|
0x7C100400, // 0012 CALL R4 2
|
||||||
0x7C100400, // 0013 CALL R4 2
|
0x4C140000, // 0013 LDNIL R5
|
||||||
0x4C140000, // 0014 LDNIL R5
|
0x20140805, // 0014 NE R5 R4 R5
|
||||||
0x20140805, // 0015 NE R5 R4 R5
|
0x7816000D, // 0015 JMPF R5 #0024
|
||||||
0x7816000D, // 0016 JMPF R5 #0025
|
0xA4161800, // 0016 IMPORT R5 K12
|
||||||
0xA4161600, // 0017 IMPORT R5 K11
|
0x8C180B0D, // 0017 GETMET R6 R5 K13
|
||||||
0x8C180B0C, // 0018 GETMET R6 R5 K12
|
0x5820000E, // 0018 LDCONST R8 K14
|
||||||
0x5820000D, // 0019 LDCONST R8 K13
|
0x88240100, // 0019 GETMBR R9 R0 K0
|
||||||
0x88240100, // 001A GETMBR R9 R0 K0
|
0x8824130F, // 001A GETMBR R9 R9 K15
|
||||||
0x8824130E, // 001B GETMBR R9 R9 K14
|
0x88280110, // 001B GETMBR R10 R0 K16
|
||||||
0x8828010F, // 001C GETMBR R10 R0 K15
|
0x5C2C0800, // 001C MOVE R11 R4
|
||||||
0x5C2C0800, // 001D MOVE R11 R4
|
0x7C180A00, // 001D CALL R6 5
|
||||||
0x7C180A00, // 001E CALL R6 5
|
0xB81E0E00, // 001E GETNGBL R7 K7
|
||||||
0xB81E0C00, // 001F GETNGBL R7 K6
|
0x8C1C0F08, // 001F GETMET R7 R7 K8
|
||||||
0x8C1C0F07, // 0020 GETMET R7 R7 K7
|
0x58240009, // 0020 LDCONST R9 K9
|
||||||
0x58240008, // 0021 LDCONST R9 K8
|
0x84280001, // 0021 CLOSURE R10 P1
|
||||||
0x84280001, // 0022 CLOSURE R10 P1
|
0x7C1C0600, // 0022 CALL R7 3
|
||||||
0x7C1C0600, // 0023 CALL R7 3
|
0xA0140000, // 0023 CLOSE R5
|
||||||
0xA0140000, // 0024 CLOSE R5
|
0xA0000000, // 0024 CLOSE R0
|
||||||
0xA0000000, // 0025 CLOSE R0
|
0x80000000, // 0025 RET 0
|
||||||
0x80000000, // 0026 RET 0
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
20
pio-tools/copy_safemode.py
Normal file
20
pio-tools/copy_safemode.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from os.path import join
|
||||||
|
from SCons.Script import DefaultEnvironment
|
||||||
|
|
||||||
|
env = DefaultEnvironment()
|
||||||
|
platform = env.PioPlatform()
|
||||||
|
|
||||||
|
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
|
||||||
|
|
||||||
|
safemode_dir = join(env["PROJECT_DIR"], "safemode")
|
||||||
|
variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota")
|
||||||
|
|
||||||
|
if env["PIOPLATFORM"] == "espressif32":
|
||||||
|
if os.path.exists(safemode_dir):
|
||||||
|
# print("safemode.bin dir exists")
|
||||||
|
if os.path.exists(variants_dir):
|
||||||
|
# print("variants/tasmota exists")
|
||||||
|
shutil.rmtree(variants_dir)
|
||||||
|
shutil.copytree(safemode_dir, variants_dir)
|
@ -91,7 +91,7 @@ lib_extra_dirs = ${library.lib_extra_dirs}
|
|||||||
[env:tasmota32_base]
|
[env:tasmota32_base]
|
||||||
; *** Uncomment next lines ";" to enable development Tasmota Arduino version ESP32
|
; *** Uncomment next lines ";" to enable development Tasmota Arduino version ESP32
|
||||||
;platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.3rc1/platform-espressif32-2.0.3new.zip
|
;platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.3rc1/platform-espressif32-2.0.3new.zip
|
||||||
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/822/framework-arduinoespressif32-v4.4_work-c4b83228a5.tar.gz
|
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/825/framework-arduinoespressif32-v4.4_work-c4b83228a5.tar.gz
|
||||||
build_unflags = ${esp32_defaults.build_unflags}
|
build_unflags = ${esp32_defaults.build_unflags}
|
||||||
build_flags = ${esp32_defaults.build_flags}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ build_flags = ${esp_defaults.build_flags}
|
|||||||
-Wl,--wrap=panicHandler -Wl,--wrap=xt_unhandled_exception
|
-Wl,--wrap=panicHandler -Wl,--wrap=xt_unhandled_exception
|
||||||
-Wl,--wrap=_Z11analogWritehi ; `analogWrite(unsigned char, int)` use the Tasmota version of analogWrite for deeper integration and phase control
|
-Wl,--wrap=_Z11analogWritehi ; `analogWrite(unsigned char, int)` use the Tasmota version of analogWrite for deeper integration and phase control
|
||||||
extra_scripts = pre:pio-tools/add_c_flags.py
|
extra_scripts = pre:pio-tools/add_c_flags.py
|
||||||
|
pre:pio-tools/copy_safemode.py
|
||||||
post:pio-tools/post_esp32.py
|
post:pio-tools/post_esp32.py
|
||||||
${esp_defaults.extra_scripts}
|
${esp_defaults.extra_scripts}
|
||||||
|
|
||||||
|
BIN
safemode/tasmota32-minicustom.bin
Normal file
BIN
safemode/tasmota32-minicustom.bin
Normal file
Binary file not shown.
@ -73,6 +73,8 @@ class AXP192_M5Stack_Core2 : AXP192
|
|||||||
|
|
||||||
# bus power mode_output
|
# bus power mode_output
|
||||||
self.set_buf_power_mode(false)
|
self.set_buf_power_mode(false)
|
||||||
|
|
||||||
|
tasmota.add_driver(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -132,5 +134,4 @@ class AXP192_M5Stack_Core2 : AXP192
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
axp = AXP192_M5Stack_Core2()
|
return AXP192_M5Stack_Core2()
|
||||||
tasmota.add_driver(axp)
|
|
@ -88,6 +88,8 @@ class AXP192_M5Stack_Tough : AXP192
|
|||||||
else
|
else
|
||||||
self.set_buf_power_mode(false)
|
self.set_buf_power_mode(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tasmota.add_driver(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -147,5 +149,4 @@ class AXP192_M5Stack_Tough : AXP192
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
axp = AXP192_M5Stack_Tough()
|
return AXP192_M5Stack_Tough()
|
||||||
tasmota.add_driver(axp)
|
|
@ -67,6 +67,8 @@ class AXP192_M5StickC : AXP192
|
|||||||
# Bit 1: APS voltage ADC enable
|
# Bit 1: APS voltage ADC enable
|
||||||
# Bit 0: TS pin ADC function enable
|
# Bit 0: TS pin ADC function enable
|
||||||
self.write8(0x82, 0xFF)
|
self.write8(0x82, 0xFF)
|
||||||
|
|
||||||
|
tasmota.add_driver(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -103,5 +105,4 @@ class AXP192_M5StickC : AXP192
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
axp = AXP192_M5StickC()
|
return AXP192_M5StickC()
|
||||||
tasmota.add_driver(axp)
|
|
@ -40,6 +40,8 @@ class AXP202_LilyGo_TWatch_2020V3 : AXP202
|
|||||||
# // No use
|
# // No use
|
||||||
# power->setPowerOutPut(AXP202_LDO3, false);
|
# power->setPowerOutPut(AXP202_LDO3, false);
|
||||||
self.set_ldo_enable(3, false)
|
self.set_ldo_enable(3, false)
|
||||||
|
|
||||||
|
tasmota.add_driver(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -66,5 +68,4 @@ class AXP202_LilyGo_TWatch_2020V3 : AXP202
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
axp202 = AXP202_LilyGo_TWatch_2020V3()
|
return AXP202_LilyGo_TWatch_2020V3()
|
||||||
tasmota.add_driver(axp202)
|
|
78
tasmota/berry/drivers/CHSC6540.be
Normal file
78
tasmota/berry/drivers/CHSC6540.be
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
#-
|
||||||
|
- I2C driver for the Touch Screen driver CHSC6540 of the M5Stack Tough
|
||||||
|
-
|
||||||
|
- This is based on
|
||||||
|
- https://github.com/m5stack/M5Tough/blob/master/src/M5Touch.cpp
|
||||||
|
- https://github.com/m5stack/M5Tough/blob/master/src/M5Touch.h
|
||||||
|
-#
|
||||||
|
|
||||||
|
class CHSC6540 : I2C_Driver
|
||||||
|
var tp_int # gpio used as INT - going low when the screen is touched
|
||||||
|
# prevous values
|
||||||
|
var touched, x, y # previous values (bool, int, int) to be repeated when not touched
|
||||||
|
|
||||||
|
def init()
|
||||||
|
# set current values
|
||||||
|
self.x = 0
|
||||||
|
self.y = 0
|
||||||
|
self.touched = false
|
||||||
|
|
||||||
|
self.tp_int = gpio.pin(gpio.INTERRUPT, 0)
|
||||||
|
super(self).init("CHSC6540", 0x2E)
|
||||||
|
|
||||||
|
tasmota.add_driver(self)
|
||||||
|
# check that display is present
|
||||||
|
import introspect
|
||||||
|
if !introspect.module("display")
|
||||||
|
tasmota.log("I2C: can't start CHSC6540 without display enabled", 3)
|
||||||
|
self.wire = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.tp_int < 0
|
||||||
|
tasmota.log("I2C: can't start CHSC6540 without INTERRUPT-1 gpio configured", 3)
|
||||||
|
self.wire = nil
|
||||||
|
else
|
||||||
|
gpio.pin_mode(self.tp_int, gpio.INPUT_PULLUP)
|
||||||
|
end
|
||||||
|
|
||||||
|
# all good, configure device
|
||||||
|
if self.wire
|
||||||
|
self.write8(0x5A, 0x5A) # INT mode change
|
||||||
|
|
||||||
|
tasmota.add_driver(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# is the screen pressed - i.e. TP_INT is low
|
||||||
|
def is_pressed()
|
||||||
|
if self.wire == nil return end
|
||||||
|
return gpio.digital_read(self.tp_int) == 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def every_50ms()
|
||||||
|
if self.wire == nil return end
|
||||||
|
|
||||||
|
self.touched = self.is_pressed()
|
||||||
|
# tasmota.log("DEBUG> int="+str(self.tp_int)+" touched="+str(self.touched), 2)
|
||||||
|
if self.touched
|
||||||
|
import string
|
||||||
|
var raw_read = self.wire.read_bytes(self.addr, 0x02, 11) # read a series of 11 bytes at from register 0x02
|
||||||
|
var pts = raw_read[0]
|
||||||
|
if pts <= 0 || pts > 2 return end # wrong
|
||||||
|
# supports multi-touch
|
||||||
|
#var p0f = (raw_read[4] & 0x10) != 0 # unused for now
|
||||||
|
self.x = raw_read.get(1,-2) & 0x0FFF
|
||||||
|
self.y = raw_read.get(3,-2) & 0x0FFF
|
||||||
|
# tasmota.log(string.format("I2C: screen pressed x=%i y=%i", self.x, self.y), 2)
|
||||||
|
# var p1x = raw_read.get(7,2) & 0x0FFF
|
||||||
|
# var p1y = raw_read.get(9,2) & 0x0FFF
|
||||||
|
end
|
||||||
|
|
||||||
|
# return values
|
||||||
|
import display
|
||||||
|
display.touch_update(self.touched ? 1 : 0, self.x, self.y, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
return CHSC6540()
|
@ -5,7 +5,7 @@
|
|||||||
- Alternative to xsns_85_mpu6886.ino
|
- Alternative to xsns_85_mpu6886.ino
|
||||||
-#
|
-#
|
||||||
|
|
||||||
class MPU6886 : I2C_Driver
|
class MPU6886_9250 : I2C_Driver
|
||||||
var device
|
var device
|
||||||
var gres, ares
|
var gres, ares
|
||||||
var accel, gyro
|
var accel, gyro
|
||||||
@ -49,6 +49,8 @@ class MPU6886 : I2C_Driver
|
|||||||
|
|
||||||
self.gres = 2000.0/32768.0
|
self.gres = 2000.0/32768.0
|
||||||
self.ares = 8.0/32678.0
|
self.ares = 8.0/32678.0
|
||||||
|
|
||||||
|
tasmota.add_driver(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -133,5 +135,4 @@ class MPU6886 : I2C_Driver
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mpu_accel = MPU6886()
|
return MPU6886_9250()
|
||||||
tasmota.add_driver(mpu_accel)
|
|
@ -77,4 +77,4 @@ class Shift595
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return Shift595 # allow using 'import' instead of 'load()'
|
return Shift595() # allow using 'import' instead of 'load()'
|
||||||
|
@ -24,6 +24,10 @@ class lv_touch_3_buttons
|
|||||||
# Pre-condition:
|
# Pre-condition:
|
||||||
# LVGL must be already started
|
# LVGL must be already started
|
||||||
def init(btn1, btn2, btn3, active_low)
|
def init(btn1, btn2, btn3, active_low)
|
||||||
|
import global
|
||||||
|
if !global.contains("lv") return end # abort if LVGL is not there
|
||||||
|
lv.start() # make sure LVGL is started, or things can go really wrong
|
||||||
|
|
||||||
# set current values
|
# set current values
|
||||||
self.x = 0
|
self.x = 0
|
||||||
self.y = 0
|
self.y = 0
|
||||||
@ -44,6 +48,9 @@ class lv_touch_3_buttons
|
|||||||
var vres = lv.get_ver_res() # should be 240
|
var vres = lv.get_ver_res() # should be 240
|
||||||
self.x_coords = [ hres / 6, hres / 2, hres * 5 / 6]
|
self.x_coords = [ hres / 6, hres / 2, hres * 5 / 6]
|
||||||
self.y_coords = [ vres - 10, vres - 10, vres - 10]
|
self.y_coords = [ vres - 10, vres - 10, vres - 10]
|
||||||
|
|
||||||
|
# add self to drivers
|
||||||
|
tasmota.add_driver(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
# scan every 50ms
|
# scan every 50ms
|
||||||
@ -78,9 +85,9 @@ class lv_touch_3_buttons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return lv_touch_3_buttons
|
return lv_touch_3_buttons(gpio.pin(gpio.INPUT, 0), gpio.pin(gpio.INPUT, 1), gpio.pin(gpio.INPUT, 2), true)
|
||||||
|
|
||||||
#-
|
#-
|
||||||
lv_btn3 = lv_touch_3_buttons(gpio.pin(gpio.INPUT, 0), gpio.pin(gpio.INPUT, 1), gpio.pin(gpio.INPUT, 2), lv_touch_3_buttons.ACTIVE_LOW)
|
lv_btn3 = lv_touch_3_buttons(gpio.pin(gpio.INPUT, 0), gpio.pin(gpio.INPUT, 1), gpio.pin(gpio.INPUT, 2), lv_touch_3_buttons.ACTIVE_LOW)
|
||||||
tasmota.add_driver(lv_btn3)
|
tasmota.add_driver(lv_btn3)
|
||||||
-#
|
-#
|
@ -532,8 +532,8 @@ class Partition_manager_UI
|
|||||||
webserver.content_send(string.format("<p><b>Used: </b>%i KB</p>", used / 1024))
|
webserver.content_send(string.format("<p><b>Used: </b>%i KB</p>", used / 1024))
|
||||||
webserver.content_send(string.format("<p><b>Free: </b>%i KB</p>", (slot.size - used) / 1024))
|
webserver.content_send(string.format("<p><b>Free: </b>%i KB</p>", (slot.size - used) / 1024))
|
||||||
else
|
else
|
||||||
webserver.content_send("<p><b>Used</b>: unknwon</p>")
|
webserver.content_send("<p><b>Used</b>: unknown</p>")
|
||||||
webserver.content_send("<p><b>Free</b>: unknwon</p>")
|
webserver.content_send("<p><b>Free</b>: unknown</p>")
|
||||||
end
|
end
|
||||||
if !active && used > 0
|
if !active && used > 0
|
||||||
webserver.content_send("<p><form id=setactive style='display: block;' action='/part_mgr' method='post' ")
|
webserver.content_send("<p><form id=setactive style='display: block;' action='/part_mgr' method='post' ")
|
||||||
|
Binary file not shown.
@ -3,6 +3,8 @@
|
|||||||
# use `import openhasp` and set the JSONL definitions in `pages.jsonl`
|
# use `import openhasp` and set the JSONL definitions in `pages.jsonl`
|
||||||
#
|
#
|
||||||
# As an optimization `0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#` is replaced with `0`
|
# As an optimization `0 #- lv.PART_MAIN | lv.STATE_DEFAULT -#` is replaced with `0`
|
||||||
|
#
|
||||||
|
# rm openhasp.tapp; zip -j -0 openhasp.tapp openhasp_core/*
|
||||||
#################################################################################
|
#################################################################################
|
||||||
# How to solidify (needs an ESP32 with PSRAM)
|
# How to solidify (needs an ESP32 with PSRAM)
|
||||||
#-
|
#-
|
||||||
@ -268,7 +270,8 @@ class lvh_obj
|
|||||||
# self._lv_obj.add_event_cb(/ obj, event -> self.action_cb(obj, event), lv.EVENT_CLICKED, 0)
|
# self._lv_obj.add_event_cb(/ obj, event -> self.action_cb(obj, event), lv.EVENT_CLICKED, 0)
|
||||||
end
|
end
|
||||||
def get_action()
|
def get_action()
|
||||||
return self._action
|
var action = self._action
|
||||||
|
return action ? action : "" # cannot be `nil` as it would mean no member
|
||||||
end
|
end
|
||||||
|
|
||||||
#====================================================================
|
#====================================================================
|
||||||
@ -305,7 +308,7 @@ class lvh_obj
|
|||||||
# print("-> CB fired","self",self,"obj",obj,"event",event.tomap(),"code",event.code)
|
# print("-> CB fired","self",self,"obj",obj,"event",event.tomap(),"code",event.code)
|
||||||
var oh = self._page._oh # openhasp global object
|
var oh = self._page._oh # openhasp global object
|
||||||
var code = event.code # materialize to a local variable, otherwise the value can change (and don't capture event object)
|
var code = event.code # materialize to a local variable, otherwise the value can change (and don't capture event object)
|
||||||
if self.action != nil && code == lv.EVENT_CLICKED
|
if self.action != "" && code == lv.EVENT_CLICKED
|
||||||
# if clicked and action is declared, do the page change event
|
# if clicked and action is declared, do the page change event
|
||||||
tasmota.set_timer(0, /-> oh.do_action(self, code))
|
tasmota.set_timer(0, /-> oh.do_action(self, code))
|
||||||
end
|
end
|
||||||
@ -1397,11 +1400,11 @@ class OpenHASP
|
|||||||
# Arg2: LVGL event fired
|
# Arg2: LVGL event fired
|
||||||
# Returns: nil
|
# Returns: nil
|
||||||
#====================================================================
|
#====================================================================
|
||||||
def do_action(lvh_obj, event_code)
|
def do_action(lvh_object, event_code)
|
||||||
if event_code != lv.EVENT_CLICKED return end
|
if event_code != lv.EVENT_CLICKED return end
|
||||||
var action = lvh_obj._action
|
var action = lvh_object._action
|
||||||
var cur_page = self.lvh_pages[self.lvh_page_cur_idx]
|
var cur_page = self.lvh_pages[self.lvh_page_cur_idx]
|
||||||
# print("do_action","lvh_obj",lvh_obj,"action",action,"cur_page",cur_page,self.lvh_page_cur_idx)
|
# print("do_action","lvh_object",lvh_object,"action",action,"cur_page",cur_page,self.lvh_page_cur_idx)
|
||||||
|
|
||||||
# action can be `prev`, `next`, `back`, or `p<number>` like `p1`
|
# action can be `prev`, `next`, `back`, or `p<number>` like `p1`
|
||||||
var to_page = nil
|
var to_page = nil
|
||||||
|
Binary file not shown.
@ -39,6 +39,7 @@ end
|
|||||||
run_watch()
|
run_watch()
|
||||||
|
|
||||||
def p5_in()
|
def p5_in()
|
||||||
|
import global
|
||||||
global.p0b101.bg_opa = 0
|
global.p0b101.bg_opa = 0
|
||||||
global.p0b102.bg_opa = 0
|
global.p0b102.bg_opa = 0
|
||||||
global.p0b103.bg_opa = 0
|
global.p0b103.bg_opa = 0
|
||||||
@ -46,6 +47,7 @@ def p5_in()
|
|||||||
end
|
end
|
||||||
|
|
||||||
def p5_out()
|
def p5_out()
|
||||||
|
import global
|
||||||
global.p0b101.bg_opa = 255
|
global.p0b101.bg_opa = 255
|
||||||
global.p0b102.bg_opa = 255
|
global.p0b102.bg_opa = 255
|
||||||
global.p0b103.bg_opa = 255
|
global.p0b103.bg_opa = 255
|
||||||
|
@ -1898,14 +1898,17 @@ void SetSerialBegin(void) {
|
|||||||
SetSerialSwap();
|
SetSerialSwap();
|
||||||
#endif // ESP8266
|
#endif // ESP8266
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
|
#ifdef ARDUINO_USB_CDC_ON_BOOT
|
||||||
|
// Serial.end();
|
||||||
|
// Serial.begin();
|
||||||
|
// Above sequence ends in "Exception":5,"Reason":"Load access fault"
|
||||||
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_SERIAL "HWCDC supports 115200 bit/s only"));
|
||||||
|
#else
|
||||||
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
|
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
|
||||||
Serial.end();
|
Serial.end();
|
||||||
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
|
delay(10); // Allow time to cleanup queues - if not used hangs ESP32
|
||||||
#ifdef ARDUINO_USB_CDC_ON_BOOT
|
|
||||||
Serial.begin(TasmotaGlobal.baudrate);
|
|
||||||
#else
|
|
||||||
Serial.begin(TasmotaGlobal.baudrate, ConvertSerialConfig(Settings->serial_config));
|
Serial.begin(TasmotaGlobal.baudrate, ConvertSerialConfig(Settings->serial_config));
|
||||||
#endif // ARDUINO_USB_CDC_ON_BOOT
|
#endif // Not ARDUINO_USB_CDC_ON_BOOT
|
||||||
#endif // ESP32
|
#endif // ESP32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
#ifdef FIRMWARE_LVGL
|
#ifdef FIRMWARE_LVGL
|
||||||
|
|
||||||
#undef CODE_IMAGE_STR
|
#undef CODE_IMAGE_STR
|
||||||
#define CODE_IMAGE_STR "lvgl"
|
#define CODE_IMAGE_STR "lvgl-openhasp"
|
||||||
|
|
||||||
#undef MODULE
|
#undef MODULE
|
||||||
#define MODULE WEMOS // [Module] Select default module from tasmota_template.h
|
#define MODULE WEMOS // [Module] Select default module from tasmota_template.h
|
||||||
@ -115,6 +115,7 @@
|
|||||||
#define USE_I2S
|
#define USE_I2S
|
||||||
#define USE_SPI
|
#define USE_SPI
|
||||||
#define USE_LVGL
|
#define USE_LVGL
|
||||||
|
#define USE_LVGL_OPENHASP
|
||||||
#define USE_LVGL_FREETYPE
|
#define USE_LVGL_FREETYPE
|
||||||
#undef SET_ESP32_STACK_SIZE
|
#undef SET_ESP32_STACK_SIZE
|
||||||
#define SET_ESP32_STACK_SIZE (24 * 1024)
|
#define SET_ESP32_STACK_SIZE (24 * 1024)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user