From 627f37829709ecf78df8f44a587085066b7e6836 Mon Sep 17 00:00:00 2001 From: Joris Witteman Date: Sun, 6 Mar 2022 12:36:53 +0100 Subject: [PATCH] Working core build --- firmware/.gitignore | 1 + firmware/configs/core_defconfig | 14 +- firmware/manifests/{ekeyboard.py => core.py} | 5 +- firmware/python_modules/common/boot.py | 4 +- .../{ekeyboard => core}/_device.py | 0 .../python_modules/core/factory_checks.py | 5 + .../python_modules/ekeyboard/appconfig.py | 8 - .../ekeyboard/dashboard/home.py | 5 - .../ekeyboard/dashboard/launcher.py | 1 - .../dashboard/resources/woezel_repo.py | 92 -------- .../ekeyboard/dashboard/terminal/launcher.py | 79 ------- .../dashboard/tools/reset_default.py | 3 - .../ekeyboard/dashboard/tools/update_apps.py | 29 --- .../dashboard/tools/update_firmware.py | 101 -------- .../ekeyboard/factory_checks.py | 93 -------- firmware/python_modules/ekeyboard/keyboard.py | 22 -- firmware/python_modules/ekeyboard/keycodes.py | 208 ----------------- firmware/python_modules/ekeyboard/launcher.py | 143 ------------ firmware/python_modules/ekeyboard/led.py | 36 --- firmware/python_modules/ekeyboard/led_keys.py | 221 ------------------ firmware/python_modules/ekeyboard/platform.py | 124 ---------- .../python_modules/ekeyboard/term_menu.py | 66 ------ firmware/python_modules/ekeyboard/version.py | 14 -- firmware/{sdkconfig => sdkconfig.defaults} | 202 +++++++++++++--- 24 files changed, 182 insertions(+), 1294 deletions(-) create mode 100644 firmware/.gitignore rename firmware/manifests/{ekeyboard.py => core.py} (83%) rename firmware/python_modules/{ekeyboard => core}/_device.py (100%) create mode 100644 firmware/python_modules/core/factory_checks.py delete mode 100644 firmware/python_modules/ekeyboard/appconfig.py delete mode 100644 firmware/python_modules/ekeyboard/dashboard/home.py delete mode 120000 firmware/python_modules/ekeyboard/dashboard/launcher.py delete mode 100644 firmware/python_modules/ekeyboard/dashboard/resources/woezel_repo.py delete mode 100644 firmware/python_modules/ekeyboard/dashboard/terminal/launcher.py delete mode 100644 firmware/python_modules/ekeyboard/dashboard/tools/reset_default.py delete mode 100644 firmware/python_modules/ekeyboard/dashboard/tools/update_apps.py delete mode 100644 firmware/python_modules/ekeyboard/dashboard/tools/update_firmware.py delete mode 100644 firmware/python_modules/ekeyboard/factory_checks.py delete mode 100644 firmware/python_modules/ekeyboard/keyboard.py delete mode 100644 firmware/python_modules/ekeyboard/keycodes.py delete mode 100644 firmware/python_modules/ekeyboard/launcher.py delete mode 100644 firmware/python_modules/ekeyboard/led.py delete mode 100644 firmware/python_modules/ekeyboard/led_keys.py delete mode 100644 firmware/python_modules/ekeyboard/platform.py delete mode 100644 firmware/python_modules/ekeyboard/term_menu.py delete mode 100644 firmware/python_modules/ekeyboard/version.py rename firmware/{sdkconfig => sdkconfig.defaults} (88%) diff --git a/firmware/.gitignore b/firmware/.gitignore new file mode 100644 index 0000000..5a15034 --- /dev/null +++ b/firmware/.gitignore @@ -0,0 +1 @@ +sdkconfig diff --git a/firmware/configs/core_defconfig b/firmware/configs/core_defconfig index 2ddd0fa..2619daa 100644 --- a/firmware/configs/core_defconfig +++ b/firmware/configs/core_defconfig @@ -125,15 +125,15 @@ CONFIG_PARTITION_TABLE_MD5=y # CONFIG_INFO_FIRMWARE_NAME="Unknown" CONFIG_INFO_FIRMWARE_BUILD=0 -CONFIG_INFO_HARDWARE_NAME="EKeyboard" -CONFIG_MICROPY_FROZEN_MANIFEST="ekeyboard.py" -CONFIG_INFO_HARDWARE_WOEZEL_NAME="ekeyboard" -CONFIG_OTA_WEB_SERVER="ekeyboard.wittemanlabs.nl" +CONFIG_INFO_HARDWARE_NAME="Core" +CONFIG_MICROPY_FROZEN_MANIFEST="core.py" +CONFIG_INFO_HARDWARE_WOEZEL_NAME="core" +CONFIG_OTA_WEB_SERVER="" CONFIG_OTA_WEB_USE_HTTPS=y CONFIG_OTA_WEB_PORT=443 -CONFIG_OTA_WEB_PATH="/version/ekeyboard.bin" -CONFIG_OTA_WEB_VERSION_PATH="/version/ekeyboard.txt" -CONFIG_WOEZEL_WEB_SERVER="apps.wittemanlabs.nl" +CONFIG_OTA_WEB_PATH="" +CONFIG_OTA_WEB_VERSION_PATH="" +CONFIG_WOEZEL_WEB_SERVER="" CONFIG_WIFI_SSID="badge" CONFIG_WIFI_PASSWORD="" CONFIG_DEFAULT_DISPLAY_ORIENTATION_LANDSCAPE=y diff --git a/firmware/manifests/ekeyboard.py b/firmware/manifests/core.py similarity index 83% rename from firmware/manifests/ekeyboard.py rename to firmware/manifests/core.py index 185fd32..e1df6a3 100644 --- a/firmware/manifests/ekeyboard.py +++ b/firmware/manifests/core.py @@ -3,9 +3,10 @@ freeze("$(MPY_DIR)/drivers/onewire") include("$(MPY_DIR)/extmod/uasyncio/manifest.py") include("$(MPY_DIR)/extmod/webrepl/manifest.py") -freeze("../python_modules/ekeyboard") freeze("../python_modules/common", ("rtc.py", "upysh.py", "valuestore.py", "shell.py", "term.py", "virtualtimers.py", "wifi.py", "system.py", "ntp.py", "boot.py", "_boot.py")) freeze("../python_modules/common", "tasks/powermanagement.py") freeze("../python_modules/common", "tasks/otacheck.py") freeze("../python_modules/common", "umqtt") -freeze("../python_modules/woezel") \ No newline at end of file +freeze("../python_modules/woezel") +freeze("../python_modules/core") +freeze("../python_modules/common", "dashboard") \ No newline at end of file diff --git a/firmware/python_modules/common/boot.py b/firmware/python_modules/common/boot.py index 2b029b8..07408eb 100644 --- a/firmware/python_modules/common/boot.py +++ b/firmware/python_modules/common/boot.py @@ -39,8 +39,8 @@ app = "factory_checks" else: app = rtcmem.read_string() - if not app: - app = 'dashboard.home' + # if not app: + # app = 'dashboard.home' del fc_level del __chk_recovery diff --git a/firmware/python_modules/ekeyboard/_device.py b/firmware/python_modules/core/_device.py similarity index 100% rename from firmware/python_modules/ekeyboard/_device.py rename to firmware/python_modules/core/_device.py diff --git a/firmware/python_modules/core/factory_checks.py b/firmware/python_modules/core/factory_checks.py new file mode 100644 index 0000000..3a74fba --- /dev/null +++ b/firmware/python_modules/core/factory_checks.py @@ -0,0 +1,5 @@ +import esp32 + +nvs = esp32.NVS("system") +nvs.set_i32('factory_checked', 3) +nvs.commit() \ No newline at end of file diff --git a/firmware/python_modules/ekeyboard/appconfig.py b/firmware/python_modules/ekeyboard/appconfig.py deleted file mode 100644 index b6e635f..0000000 --- a/firmware/python_modules/ekeyboard/appconfig.py +++ /dev/null @@ -1,8 +0,0 @@ -import valuestore - -def get(app_slug, default_config): - config = valuestore.load(namespace='app', keyname=app_slug) - if config is None: - config = default_config - valuestore.save(namespace='app', keyname=app_slug, value=default_config) - return config \ No newline at end of file diff --git a/firmware/python_modules/ekeyboard/dashboard/home.py b/firmware/python_modules/ekeyboard/dashboard/home.py deleted file mode 100644 index 047fb72..0000000 --- a/firmware/python_modules/ekeyboard/dashboard/home.py +++ /dev/null @@ -1,5 +0,0 @@ -import keyboard -import launcher - -print("Welcome to the shell of your ESP32 device!") -print("Type 'import menu' to enter the menu.") diff --git a/firmware/python_modules/ekeyboard/dashboard/launcher.py b/firmware/python_modules/ekeyboard/dashboard/launcher.py deleted file mode 120000 index e8effa1..0000000 --- a/firmware/python_modules/ekeyboard/dashboard/launcher.py +++ /dev/null @@ -1 +0,0 @@ -terminal/launcher.py \ No newline at end of file diff --git a/firmware/python_modules/ekeyboard/dashboard/resources/woezel_repo.py b/firmware/python_modules/ekeyboard/dashboard/resources/woezel_repo.py deleted file mode 100644 index 2e10177..0000000 --- a/firmware/python_modules/ekeyboard/dashboard/resources/woezel_repo.py +++ /dev/null @@ -1,92 +0,0 @@ -import time, machine, gc, term, uos, json, urequests, gc, sys, wifi, consts - -path = "/woezel_packages" -categories = [] -lastUpdate = 0 - -try: - uos.mkdir(path) -except: - pass - -def setPath(newPath="/woezel_packages"): - global path - path = newPath - categories = [] - lastUpdate = 0 - try: - uos.mkdir(path) - except: - pass - -def _showProgress(msg, error=False, icon_wifi=False): - term.header(True, "Installer") - print(msg) - -def update(): - global path, categories, lastUpdate - if not wifi.status(): - _showProgress("Connecting to WiFi...", False, True) - wifi.connect() - if not wifi.wait(): - _showProgress("Failed to connect to WiFi.", True, False) - return False - _showProgress("Downloading categories...") - try: - request = urequests.get("https://badge.team/eggs/categories/json", timeout=30) - _showProgress("Saving categories...") - categories_file = open(path+'/categories.json', 'w') - categories_file.write(request.text) - categories_file.close() - _showProgress("Parsing categories...") - categories = request.json() - for category in categories: - gc.collect() - slug = category["slug"] - _showProgress("Downloading '"+category["name"]+"'...") - f = urequests.get("https://badge.team/basket/"+consts.INFO_HARDWARE_WOEZEL_NAME+"/category/%s/json" % slug, timeout=30) - f_file = open(path+'/'+slug+'.json', 'w') - f_file.write(f.text) - f_file.close() - lastUpdate = int(time.time()) - f = open(path+"/lastUpdate", 'w') - f.write(str(lastUpdate)) - f.close() - _showProgress("Done!") - gc.collect() - return True - except BaseException as e: - sys.print_exception(e) - _showProgress("Failed!", True) - gc.collect() - return False - -def load(): - global path, categories, lastUpdate - try: - f = open(path+"/lastUpdate", 'r') - data = f.read() - f.close() - #print("Last update at",data) - lastUpdate = int(data) - f = open(path+"/categories.json") - categories = json.loads(f.read()) - f.close() - gc.collect() - if (lastUpdate + 900) < int(time.time()): - print("Too old", lastUpdate + 900, "<", int(time.time())) - time.sleep(2) - return False - return True - except BaseException as e: - sys.print_exception(e) - time.sleep(2) - return False - -def getCategory(slug): - global path - f = open(path+"/"+slug+".json") - data = json.loads(f.read()) - f.close() - gc.collect() - return data diff --git a/firmware/python_modules/ekeyboard/dashboard/terminal/launcher.py b/firmware/python_modules/ekeyboard/dashboard/terminal/launcher.py deleted file mode 100644 index 02fe94d..0000000 --- a/firmware/python_modules/ekeyboard/dashboard/terminal/launcher.py +++ /dev/null @@ -1,79 +0,0 @@ -import term, term_menu, sys, ujson, system, machine, os - -haveSD = False -try: - os.listdir("/sd") - haveSD = True -except: - pass - -def loadInfo(folder, name): - try: - info_file = "{}/{}/metadata.json".format(folder, name) - with open(info_file) as f: - information = f.read() - return ujson.loads(information) - except BaseException as e: - sys.print_exception(e) - return {} - -def listApps(): - apps = [] - for folder in sys.path: - if folder != '': - try: - files = os.listdir(folder) - except OSError: - files = [] - for name in files: - hidden = False - app = {"path":folder+"/"+name, "name":name, "icon":None, "category":"unknown"} - metadata = loadInfo(folder, name) - if metadata: - if "name" in metadata: - app["name"] = metadata["name"] - if "category" in metadata: - app["category"] = metadata["category"] - if "icon" in metadata: - app["icon"] = metadata["icon"] - if "hidden" in metadata: - hidden = metadata["hidden"] - if not hidden: - apps.append(app) - return apps - -term.header(True, "Loading...") -apps = listApps() -amountOfUserApps = len(apps) -apps.append({"path":"dashboard.home", "name":"Home", "icon":None, "category":"system"}) -apps.append({"path":"dashboard.installer", "name":"Installer", "icon":None, "category":"system"}) -if amountOfUserApps > 0: - apps.append({"path":"dashboard.tools.uninstall", "name":"Remove an app", "icon":None, "category":"system"}) - apps.append({"path":"dashboard.tools.update_apps", "name":"Update apps", "icon":None, "category":"system"}) -if haveSD: - apps.append({"path":"dashboard.tools.movetosd", "name":"Move from/to SD", "icon":None, "category":"system"}) -apps.append({"path":"dashboard.tools.update_firmware", "name":"Update firmware", "icon":None, "category":"system"}) -apps.append({"path":"dashboard.settings.nickname", "name":"Configure nickname", "icon":None, "category":"system"}) -apps.append({"path":"dashboard.settings.wifi", "name":"WiFi setup", "icon":None, "category":"system"}) -apps.append({"path":"dashboard.other.about", "name":"About", "icon":None, "category":"system"}) - -# Terminal menu -labels = [] - -for app in apps: - label = app["name"] - if app["path"].startswith("/sd"): - label += " [SD card]" - elif app["path"].startswith("/lib"): - label += " [Legacy]" - #elif app["path"].startswith("/apps"): - # label += " [Platform]" - #else: - # label += " [Built-in]" - labels.append(label) -labels.append("< Back") - -start = term.menu("Launcher", labels, 0, "") -if start >= len(apps): - system.home() -system.start(apps[start]["path"], True) diff --git a/firmware/python_modules/ekeyboard/dashboard/tools/reset_default.py b/firmware/python_modules/ekeyboard/dashboard/tools/reset_default.py deleted file mode 100644 index 37166a4..0000000 --- a/firmware/python_modules/ekeyboard/dashboard/tools/reset_default.py +++ /dev/null @@ -1,3 +0,0 @@ -import machine, system -machine.nvs_setstr("system", 'default_app', "") -system.home() diff --git a/firmware/python_modules/ekeyboard/dashboard/tools/update_apps.py b/firmware/python_modules/ekeyboard/dashboard/tools/update_apps.py deleted file mode 100644 index 095148b..0000000 --- a/firmware/python_modules/ekeyboard/dashboard/tools/update_apps.py +++ /dev/null @@ -1,29 +0,0 @@ -import ugfx, woezel, easywifi, easydraw, system, time, os - -def stop(): - time.sleep(2) - system.launcher() - -easydraw.msg("Welcome!","Updating apps...",True) - - -if not easywifi.status(): - if not easywifi.enable(): - stop() - -try: - apps = os.listdir('lib') -except OSError: - easydraw.msg("There are no apps installed.") - stop() - -for app in apps: - easydraw.msg("Updating '"+app+"'...") - try: - woezel.install(app) - easydraw.msg("Done!") - except: - print("failed update. Already newest version?") - -easydraw.msg("All your apps are now up-to-date!") -stop() diff --git a/firmware/python_modules/ekeyboard/dashboard/tools/update_firmware.py b/firmware/python_modules/ekeyboard/dashboard/tools/update_firmware.py deleted file mode 100644 index 8d87794..0000000 --- a/firmware/python_modules/ekeyboard/dashboard/tools/update_firmware.py +++ /dev/null @@ -1,101 +0,0 @@ -import tasks.otacheck as otacheck, easydraw, term, system, time, version, wifi, ugfx, orientation, display - -orientation.default() - -term.header(True, "Update check") -print("Checking for updates...") -print("") -print("Currently installed:",version.name,"(Build "+str(version.build)+")") - -available = 0 - -def start(pressed): - if pressed: - system.ota() - -def cancel(pressed): - if pressed: - system.launcher() - -easydraw.messageCentered("PLEASE WAIT\nConnecting to WiFi...", True, "/media/wifi.png") -wifi.connect() -wifi.wait() - -easydraw.msg("Welcome!", "Firmware update", True) - -title = "Update check" -message = "Unknown state!" - -if wifi.status(): - info = otacheck.download_info() - if info: - print("Server has: ",info['name']," (Build "+str(info['build'])+")") - if info["build"] > version.build: - print("Update available!") - easydraw.msg(" ") - easydraw.msg("An update is available!") - easydraw.msg(" ") - easydraw.msg_nosplit("Currently installed: "+version.name+" (Build "+str(version.build)+")") - easydraw.msg_nosplit("Available : "+info["name"]+" (Build "+str(info["build"])+")") - easydraw.msg(" ") - easydraw.msg("Press A to start the update") - easydraw.msg("Press B to cancel") - title = "Firmware update available" - message = "A new firmware version is available. Update?\n" - message += "Currently installed: "+version.name+" (Build "+str(version.build)+")\n" - message += "Available : "+info["name"]+" (Build "+str(info["build"])+")" - elif info["build"] < version.build: - print("Server has an older version.") - easydraw.msg(" ") - easydraw.msg("A downgrade is available!") - easydraw.msg(" ") - easydraw.msg_nosplit("Currently installed: "+version.name+" (Build "+str(version.build)+")") - easydraw.msg_nosplit("Available : "+info["name"]+" (Build "+str(info["build"])+")") - easydraw.msg(" ") - easydraw.msg("Press A to start the downgrade") - easydraw.msg("Press B to cancel") - title = "Firmware downgrade available" - message = "An older firmware version is available. Update?\n" - message += "Currently installed: "+version.name+" (Build "+str(version.build)+")\n" - message += "Available : "+info["name"]+" (Build "+str(info["build"])+")" - else: - print("You are up-to-date!") - easydraw.msg(" ") - easydraw.msg("Your badge is up-to-date!") - easydraw.msg(" ") - easydraw.msg_nosplit("Currently installed: "+version.name+" (Build "+str(version.build)+")") - easydraw.msg_nosplit("Available : "+info["name"]+" (Build "+str(info["build"])+")") - easydraw.msg(" ") - easydraw.msg("Press A to start the update anyway") - easydraw.msg("Press B to cancel") - title = "Up-to-date" - message = "You are up-to-date.\n" - message += "Currently installed: "+version.name+" (Build "+str(version.build)+")\n" - message += "Available : "+info["name"]+" (Build "+str(info["build"])+")" - else: - print("An error occured!") - easydraw.msg(" ") - easydraw.msg("An error occured while checking for available updates.") - easydraw.msg(" ") - easydraw.msg_nosplit("Currently installed: "+version.name+" (Build "+str(version.build)+")") - easydraw.msg(" ") - easydraw.msg("Press A to start the update anyway") - easydraw.msg("Press B to cancel") - easydraw.msg(" ") - easydraw.msg("(Updating now will not harm your badge.)") - title = "Update check" - message = "An error occured while fetching information. You can still choose to start the OTA procedure." -else: - easydraw.msg("No WiFi!") - easydraw.msg_nosplit(str(version.build)+") "+version.name) - easydraw.msg("Update anyway?") - title = "Update check" - message = "Could not connect to the WiFi network. You can still choose to start the OTA procedure." - -ugfx.input_attach(ugfx.BTN_A, start) -ugfx.input_attach(ugfx.BTN_START, cancel) -ugfx.input_attach(ugfx.BTN_B, cancel) - -items = ["Cancel", "Start OTA update"] -callbacks = [system.home, system.ota] -callbacks[term.menu(title, items, 0, message)](True) diff --git a/firmware/python_modules/ekeyboard/factory_checks.py b/firmware/python_modules/ekeyboard/factory_checks.py deleted file mode 100644 index 1826ef3..0000000 --- a/firmware/python_modules/ekeyboard/factory_checks.py +++ /dev/null @@ -1,93 +0,0 @@ -import machine, system, esp32 -import time -import display -import led - -display.drawFill(0) -display.flush() -time.sleep(0.4) -display.drawFill(0xFFFFFF) -display.flush() -time.sleep(0.8) -display.drawFill(0) -display.flush() -time.sleep(0.4) - -for i in range (0, 3): - display.drawText(0, 0, '.'*i) - display.flush() - time.sleep(0.5) -display.drawText(0, 0, '... starting') -display.flush() - -for i in range(0, int(led.NUMEDGE/2)+1): - # if i > 0: - # led1 = (6-(i-1)) % led.NUMEDGE - # led2 = 6+(i-1) - # led.setEdge(led1, (0, 0, 0)) - # led.setEdge(led2, (0, 0, 0)) - led1 = (6-i) % led.NUMEDGE - led2 = 6+i - led.setEdge(led1, (30, 0, 0)) - led.setEdge(led2, (30, 0, 0)) - time.sleep(0.05) - -for i in range(0, led.NUMEDGE): - led.setEdge(i, (0, 0, 0), False) -led.setEdge(0, (0, 0, 0)) -time.sleep(0.4) -for i in range(0, led.NUMEDGE): - led.setEdge(i, (0, 30, 0), False) -led.setEdge(0, (0, 30, 0)) -time.sleep(0.4) -for i in range(0, led.NUMEDGE): - led.setEdge(i, (0, 0, 0), False) -led.setEdge(0, (0, 0, 0)) -time.sleep(0.4) -for i in range(0, led.NUMEDGE): - led.setEdge(i, (0, 0, 30), False) -led.setEdge(0, (0, 0, 30)) -time.sleep(0.4) -for i in range(0, led.NUMEDGE): - led.setEdge(i, (0, 0, 0), False) -led.setEdge(0, (0, 0, 0)) -time.sleep(0.4) - -rows = [range(0, 17), range(17, 17+18), range(35, 35+18), range(53, 53+17), range(70, 70+16), range(86, 100)] - -for row in rows: - for i in row: - led.setKey(i, (30,30,30), flush=False) - led.keyFlush() - time.sleep(0.7) - for i in row: - led.setKey(i, (0,0,0), flush=False) - led.keyFlush() - -for i in range(0, led.NUMKEYS): - led.setKey(i, (30,30,30)) -time.sleep(0.5) -for i in range(0, led.NUMKEYS): - led.setKey(i, (0,0,0), flush=False) -led.keyFlush() - - - -text = "Happy\nBirthday" -height = display.getTextHeight(text) -width = display.getTextWidth(text) -offsetx = int((128-width)/2) -offsety = int((64-height)/2) - -display.drawFill(0) -display.drawText(offsetx, offsety, text) -display.flush() -time.sleep(5) -## -# Add any hardware checks needed to test the device after initial flashing. -# This runs only once, and disables itself afterwards with the following line: -nvs = esp32.NVS('system') -nvs.set_i32('factory_checked', 3) -nvs.commit() - -system.reboot() diff --git a/firmware/python_modules/ekeyboard/keyboard.py b/firmware/python_modules/ekeyboard/keyboard.py deleted file mode 100644 index 49ab716..0000000 --- a/firmware/python_modules/ekeyboard/keyboard.py +++ /dev/null @@ -1,22 +0,0 @@ -import platform -import led -import led_keys - -def ledstatus(status): - if status & 0x01: - led.setKey(led_keys.NUMLOCK, (0x10, 0x10, 0x10)) - else: - led.setKey(led_keys.NUMLOCK, (0, 0, 0)) - if status & 0x02: - led.setKey(led_keys.CAPSLOCK, (0x10, 0x10, 0x10)) - else: - led.setKey(led_keys.CAPSLOCK, (0,0,0)) - -def shutdown_keyboard_manager(): - platform.remove_statusled_handler(ledstatus) - -def start_keyboard_manager(): - platform.add_statusled_handler(ledstatus) - -platform.add_statusled_handler(ledstatus) -platform.backlit_power() diff --git a/firmware/python_modules/ekeyboard/keycodes.py b/firmware/python_modules/ekeyboard/keycodes.py deleted file mode 100644 index fbf0fa2..0000000 --- a/firmware/python_modules/ekeyboard/keycodes.py +++ /dev/null @@ -1,208 +0,0 @@ -keymap_noshift = {} -keymap_noshift[0x04]='a' -keymap_noshift[0x05]='b' -keymap_noshift[0x06]='c' -keymap_noshift[0x07]='d' -keymap_noshift[0x08]='e' -keymap_noshift[0x09]='f' -keymap_noshift[0x0A]='g' -keymap_noshift[0x0B]='h' -keymap_noshift[0x0C]='i' -keymap_noshift[0x0D]='j' -keymap_noshift[0x0E]='k' -keymap_noshift[0x0F]='l' -keymap_noshift[0x10]='m' -keymap_noshift[0x11]='n' -keymap_noshift[0x12]='o' -keymap_noshift[0x13]='p' -keymap_noshift[0x14]='q' -keymap_noshift[0x15]='r' -keymap_noshift[0x16]='s' -keymap_noshift[0x17]='t' -keymap_noshift[0x18]='u' -keymap_noshift[0x19]='v' -keymap_noshift[0x1A]='w' -keymap_noshift[0x1B]='x' -keymap_noshift[0x1C]='y' -keymap_noshift[0x1D]='z' -keymap_noshift[0x1E]='1' -keymap_noshift[0x1F]='2' -keymap_noshift[0x20]='3' -keymap_noshift[0x21]='4' -keymap_noshift[0x22]='5' -keymap_noshift[0x23]='6' -keymap_noshift[0x24]='7' -keymap_noshift[0x25]='8' -keymap_noshift[0x26]='9' -keymap_noshift[0x27]='0' -keymap_noshift[0x28]='\n' -keymap_noshift[0x29]='' -keymap_noshift[0x2A]='\b' -keymap_noshift[0x2B]='\t' -keymap_noshift[0x2C]=' ' -keymap_noshift[0x2D]='-' -keymap_noshift[0x2E]='=' -keymap_noshift[0x2F]='[' -keymap_noshift[0x30]=']' -keymap_noshift[0x31]='\\' -keymap_noshift[0x33]=';' -keymap_noshift[0x34]='\'' -keymap_noshift[0x35]='`' -keymap_noshift[0x36]=',' -keymap_noshift[0x37]='.' -keymap_noshift[0x38]='/' -keymap_noshift[0x39]='' -keymap_noshift[0x3A]='' -keymap_noshift[0x3B]='' -keymap_noshift[0x3C]='' -keymap_noshift[0x3D]='' -keymap_noshift[0x3E]='' -keymap_noshift[0x3F]='' -keymap_noshift[0x40]='' -keymap_noshift[0x41]='' -keymap_noshift[0x42]='' -keymap_noshift[0x43]='' -keymap_noshift[0x44]='' -keymap_noshift[0x45]='' -keymap_noshift[0x49]='' -keymap_noshift[0x4B]='' -keymap_noshift[0x4C]='' -keymap_noshift[0x4E]='' -keymap_noshift[0x4F]='' -keymap_noshift[0x50]='' -keymap_noshift[0x51]='' -keymap_noshift[0x52]='' -keymap_noshift[0x53]='' -keymap_noshift[0x54]='/' -keymap_noshift[0x55]='*' -keymap_noshift[0x56]='-' -keymap_noshift[0x57]='+' -keymap_noshift[0x58]='/n' -keymap_noshift[0x59]='1' -keymap_noshift[0x5A]='2' -keymap_noshift[0x5B]='3' -keymap_noshift[0x5C]='4' -keymap_noshift[0x5D]='5' -keymap_noshift[0x5E]='6' -keymap_noshift[0x5F]='7' -keymap_noshift[0x60]='8' -keymap_noshift[0x61]='9' -keymap_noshift[0x62]='0' -keymap_noshift[0x63]='.' -keymap_noshift[0xE0]='' -keymap_noshift[0xE1]='' -keymap_noshift[0xE2]='' -keymap_noshift[0xE3]='' -keymap_noshift[0xE4]='' -keymap_noshift[0xE5]='' -keymap_noshift[0xE6]='' -keymap_noshift[0xFF]='' - -keymap_shift = {} -keymap_shift[0x04]='A' -keymap_shift[0x05]='B' -keymap_shift[0x06]='C' -keymap_shift[0x07]='D' -keymap_shift[0x08]='E' -keymap_shift[0x09]='F' -keymap_shift[0x0A]='G' -keymap_shift[0x0B]='H' -keymap_shift[0x0C]='I' -keymap_shift[0x0D]='J' -keymap_shift[0x0E]='K' -keymap_shift[0x0F]='L' -keymap_shift[0x10]='M' -keymap_shift[0x11]='N' -keymap_shift[0x12]='O' -keymap_shift[0x13]='P' -keymap_shift[0x14]='Q' -keymap_shift[0x15]='R' -keymap_shift[0x16]='S' -keymap_shift[0x17]='T' -keymap_shift[0x18]='U' -keymap_shift[0x19]='V' -keymap_shift[0x1A]='W' -keymap_shift[0x1B]='X' -keymap_shift[0x1C]='Y' -keymap_shift[0x1D]='Z' -keymap_shift[0x1E]='!' -keymap_shift[0x1F]='@' -keymap_shift[0x20]='#' -keymap_shift[0x21]='$' -keymap_shift[0x22]='%' -keymap_shift[0x23]='^' -keymap_shift[0x24]='&' -keymap_shift[0x25]='*' -keymap_shift[0x26]='(' -keymap_shift[0x27]=')' -keymap_shift[0x28]='\n' -keymap_shift[0x29]='' -keymap_shift[0x2A]='\b' -keymap_shift[0x2B]='\t' -keymap_shift[0x2C]=' ' -keymap_shift[0x2D]='_' -keymap_shift[0x2E]='+' -keymap_shift[0x2F]='{' -keymap_shift[0x30]='}' -keymap_shift[0x31]='|' -keymap_shift[0x33]=':' -keymap_shift[0x34]='"' -keymap_shift[0x35]='~' -keymap_shift[0x36]='<' -keymap_shift[0x37]='>' -keymap_shift[0x38]='?' -keymap_shift[0x39]='' -keymap_shift[0x3A]='' -keymap_shift[0x3B]='' -keymap_shift[0x3C]='' -keymap_shift[0x3D]='' -keymap_shift[0x3E]='' -keymap_shift[0x3F]='' -keymap_shift[0x40]='' -keymap_shift[0x41]='' -keymap_shift[0x42]='' -keymap_shift[0x43]='' -keymap_shift[0x44]='' -keymap_shift[0x45]='' -keymap_shift[0x49]='' -keymap_shift[0x4B]='' -keymap_shift[0x4C]='' -keymap_shift[0x4E]='' -keymap_shift[0x4F]='' -keymap_shift[0x50]='' -keymap_shift[0x51]='' -keymap_shift[0x52]='' -keymap_shift[0x53]='' -keymap_shift[0x54]='/' -keymap_shift[0x55]='*' -keymap_shift[0x56]='-' -keymap_shift[0x57]='+' -keymap_shift[0x58]='/n' -keymap_shift[0x59]='1' -keymap_shift[0x5A]='2' -keymap_shift[0x5B]='3' -keymap_shift[0x5C]='4' -keymap_shift[0x5D]='5' -keymap_shift[0x5E]='6' -keymap_shift[0x5F]='7' -keymap_shift[0x60]='8' -keymap_shift[0x61]='9' -keymap_shift[0x62]='0' -keymap_shift[0x63]='.' -keymap_shift[0xE0]='' -keymap_shift[0xE1]='' -keymap_shift[0xE2]='' -keymap_shift[0xE3]='' -keymap_shift[0xE4]='' -keymap_shift[0xE5]='' -keymap_shift[0xE6]='' -keymap_shift[0xFF]='' - -def getchar(hidcode, shift=False): - if not shift: - if hidcode in keymap_noshift: - return keymap_noshift[hidcode] - else: - if hidcode in keymap_shift: - return keymap_shift[hidcode] - return '' \ No newline at end of file diff --git a/firmware/python_modules/ekeyboard/launcher.py b/firmware/python_modules/ekeyboard/launcher.py deleted file mode 100644 index 90c1bc0..0000000 --- a/firmware/python_modules/ekeyboard/launcher.py +++ /dev/null @@ -1,143 +0,0 @@ -import display -import platform -import os -import woezel -import sys -import machine -import system -import ujson -import esp32 - -nvs = esp32.NVS("launcher") - -apps = [] -current_index = 0 -current_icon = None -enabled_keyboard = True - -numlock = False -capslock = False - -def add_app(app, information): - global apps - install_path = woezel.get_install_path() - try: - title = information["name"] - except: - title = app - try: - category = information["category"] - except: - category = "" - try: - if category == "system": - icon = {'data': information["icon"]} - else: - icon = {'path': '%s/%s/icon.png' % (install_path, app)} - - except: - icon = {'data': icon_unknown} - - info = {"file": app, "title": title, "category": category, "icon": icon} - apps.append(info) - -def populate_apps(): - global apps, current_index - apps = [] - try: - userApps = os.listdir('apps') - userApps.reverse() - except OSError: - userApps = [] - for app in userApps: - add_app(app, read_metadata(app)) - - try: - current_index = nvs.get_i32('index') - except: - current_index = 0 - if current_index >= len(apps): - current_index = 0 - -# Read app metadata -def read_metadata(app): - try: - install_path = woezel.get_install_path() - info_file = "%s/%s/metadata.json" % (install_path, app) - with open(info_file) as f: - information = f.read() - return ujson.loads(information) - except BaseException as e: - #print("[ERROR] Can not read metadata for app " + app) - sys.print_exception(e) - information = {"name": app, "description": "", "category": "", "author": "", "revision": 0} - return [app, ""] - -def statushandler(led): - global numlock, capslock - numlock = led & 0x01 - capslock = led & 0x02 - render_app() - -def keyhandler(state, key): - global enabled_keyboard, apps, current_index - if key == 0xFF and state == platform.PRESSED: - enabled_keyboard = not enabled_keyboard - platform.usb_hid(enabled_keyboard) - render_app() - if not enabled_keyboard: - if key == 0x50 and state == platform.PRESSED: - current_index = current_index - 1 - if current_index < 0: - current_index = len(apps) - 1 - render_app() - if key == 0x4F and state == platform.PRESSED: - current_index = current_index + 1 - if current_index == len(apps): - current_index = 0 - render_app() - if key == 0x28 and state == platform.PRESSED: - platform.usb_hid() - system.start(apps[current_index]["file"], status=True) - -def render_app(): - global current_index, apps, numlock, capslock, enabled_keyboard - - - - display.drawFill(0) - - display.drawLine(0, 50, 127, 50, 0xFFFFFF) - display.drawLine(77, 1, 77, 48, 0xFFFFFF) - - if len(apps) > 0: - app = apps[current_index] - title = app['title'] - width = display.getTextWidth(title) - height = display.getTextHeight(title) - - posx = int((77-width)/2) - posy = int((50-height)/2) - display.drawText(posx, posy, app['title']) - if app['icon']['path']: - filename = app['icon']['path'] - try: - display.drawPng(79,1, filename) - except: - print("No icon for app") - elif app['icon']['data']: - display.drawPng(79, 1, app['icon']['data']) - - if numlock: - display.drawText(0, 51, "NUM") - if capslock: - display.drawText(63-int(display.getTextWidth("CAPS")/2), 51, "CAPS") - if not enabled_keyboard: - display.drawText(126-display.getTextWidth("APP"), 51, "APP") - display.flush() - - -populate_apps() -platform.add_keyboard_handler(keyhandler) -platform.add_statusled_handler(statushandler) -render_app() \ No newline at end of file diff --git a/firmware/python_modules/ekeyboard/led.py b/firmware/python_modules/ekeyboard/led.py deleted file mode 100644 index e4afafd..0000000 --- a/firmware/python_modules/ekeyboard/led.py +++ /dev/null @@ -1,36 +0,0 @@ -import neopixel -import led_keys - -led_keys = [0]*100*3 -led_edge = [0]*83*3 - -NUMEDGE = 83 -NUMKEYS = 100 - -def setKey(key, color, flush=True): - led_keys[key*3] = color[1] - led_keys[key*3+1] = color[0] - led_keys[key*3+2] = color[2] - if flush: - neopixel.enable(13) - neopixel.send(bytes(led_keys)) - neopixel.disable() - -def keyFlush(): - neopixel.enable(13) - neopixel.send(bytes(led_keys)) - neopixel.disable() - -def setEdge(pos, color, flush=True): - led_edge[pos*3] = color[1] - led_edge[pos*3+1] = color[0] - led_edge[pos*3+2] = color[2] - if flush: - neopixel.enable(12) - neopixel.send(bytes(led_edge)) - neopixel.disable() - -def edgeFlush(): - neopixel.enable(12) - neopixel.send(bytes(led_edge)) - neopixel.disable() \ No newline at end of file diff --git a/firmware/python_modules/ekeyboard/led_keys.py b/firmware/python_modules/ekeyboard/led_keys.py deleted file mode 100644 index 394f91b..0000000 --- a/firmware/python_modules/ekeyboard/led_keys.py +++ /dev/null @@ -1,221 +0,0 @@ -PGDN = 0 -PGUP = 1 -INSERT = 2 -DEL = 3 - -F12 = 4 -F11 = 5 -F10 = 6 -F9 = 7 - -F8 = 8 -F7 = 9 -F6 = 10 -F5 = 11 - -F4 = 12 -F3 = 13 -F2 = 14 -F1 = 15 - -ESC = 16 - -FN = 17 -NUMPAD_MUL = 18 -NUMPAD_DIV = 19 -NUMLOCK = 20 - -BACKSPACE = 21 -EQUALS = 22 -MINUS = 23 -ZERO = 24 -NINE = 25 -EIGHT = 26 -SEVEN = 27 -SIX = 28 -FIVE = 29 -FOUR = 30 -THREE = 31 -TWO = 32 -ONE = 33 -GRAVE = 34 - -NUMPAD_MIN = 35 -NUMPAD_9 = 36 -NUMPAD_8 = 37 -NUMPAD_7 = 38 - -BACKSLASH = 39 -RIGHT_BRACKET = 40 -LEFT_BRACKET = 41 -P = 42 -O = 43 -I = 44 -U = 45 -Y = 46 -T = 47 -R = 48 -E = 49 -W = 50 -Q = 51 -TAB = 52 - -NUMPAD_ADD = 53 -NUMPAD_6 = 54 -NUMPAD_5 = 55 -NUMPAD_4 = 56 - -ENTER = 57 -APOSTHROPHE = 58 -SEMICOLON = 59 -L = 60 -K = 61 -J = 62 -H = 63 -G = 64 -F = 65 -D = 66 -S = 67 -A = 68 -CAPSLOCK = 69 - -NUMPAD_ENTER = 70 -NUMPAD_3 = 71 -NUMPAD_2 = 72 -NUMPAD_1 = 73 - -RSHIFT = 74 -QUESTION = 75 -DOT = 76 -COMMA = 77 -M = 78 -N = 79 -B = 80 -V = 81 -C = 82 -X = 83 -Z = 84 -LSHIFT = 85 - -NUMPAD_DOT = 86 -NUMPAD_0 = 87 - -ARROW_RIGHT = 88 -ARROW_DOWN = 89 -ARROW_UP = 90 -ARROW_LEFT = 91 - -RCTRL = 92 -RALT = 93 -SPACEBAR_RIGHT = 94 -SPACEBAR_CENTER = 95 -SPACEBAR_LEFT = 96 -LALT = 97 -LWIN = 98 -LCTRL = 99 - -keymap = {} -keymap[0x04]=A -keymap[0x05]=B -keymap[0x06]=C -keymap[0x07]=D -keymap[0x08]=E -keymap[0x09]=F -keymap[0x0A]=G -keymap[0x0B]=H -keymap[0x0C]=I -keymap[0x0D]=J -keymap[0x0E]=K -keymap[0x0F]=L -keymap[0x10]=M -keymap[0x11]=N -keymap[0x12]=O -keymap[0x13]=P -keymap[0x14]=Q -keymap[0x15]=R -keymap[0x16]=S -keymap[0x17]=T -keymap[0x18]=U -keymap[0x19]=V -keymap[0x1A]=W -keymap[0x1B]=X -keymap[0x1C]=Y -keymap[0x1D]=Z -keymap[0x1E]=ONE -keymap[0x1F]=TWO -keymap[0x20]=THREE -keymap[0x21]=FOUR -keymap[0x22]=FIVE -keymap[0x23]=SIX -keymap[0x24]=SEVEN -keymap[0x25]=EIGHT -keymap[0x26]=NINE -keymap[0x27]=ZERO -keymap[0x28]=ENTER -keymap[0x29]=ESC -keymap[0x2A]=BACKSPACE -keymap[0x2B]=TAB -keymap[0x2C]=SPACEBAR_CENTER -keymap[0x2D]=MINUS -keymap[0x2E]=EQUALS -keymap[0x2F]=LEFT_BRACKET -keymap[0x30]=RIGHT_BRACKET -keymap[0x31]=BACKSLASH -keymap[0x33]=SEMICOLON -keymap[0x34]=APOSTHROPHE -keymap[0x35]=GRAVE -keymap[0x36]=COMMA -keymap[0x37]=DOT -keymap[0x38]=QUESTION -keymap[0x39]=CAPSLOCK -keymap[0x3A]=F1 -keymap[0x3B]=F2 -keymap[0x3C]=F3 -keymap[0x3D]=F4 -keymap[0x3E]=F5 -keymap[0x3F]=F6 -keymap[0x40]=F7 -keymap[0x41]=F8 -keymap[0x42]=F9 -keymap[0x43]=F10 -keymap[0x44]=F11 -keymap[0x45]=F12 -keymap[0x49]=INSERT -keymap[0x4B]=PGUP -keymap[0x4C]=DEL -keymap[0x4E]=PGDN -keymap[0x4F]=ARROW_RIGHT -keymap[0x50]=ARROW_LEFT -keymap[0x51]=ARROW_DOWN -keymap[0x52]=ARROW_UP -keymap[0x53]=NUMLOCK -keymap[0x54]=NUMPAD_DIV -keymap[0x55]=NUMPAD_MUL -keymap[0x56]=NUMPAD_MIN -keymap[0x57]=NUMPAD_ADD -keymap[0x58]=NUMPAD_ENTER -keymap[0x59]=NUMPAD_1 -keymap[0x5A]=NUMPAD_2 -keymap[0x5B]=NUMPAD_3 -keymap[0x5C]=NUMPAD_4 -keymap[0x5D]=NUMPAD_5 -keymap[0x5E]=NUMPAD_6 -keymap[0x5F]=NUMPAD_7 -keymap[0x60]=NUMPAD_8 -keymap[0x61]=NUMPAD_9 -keymap[0x62]=NUMPAD_0 -keymap[0x63]=NUMPAD_DOT -keymap[0xE0]=LCTRL -keymap[0xE1]=LSHIFT -keymap[0xE2]=LALT -keymap[0xE3]=LWIN -keymap[0xE4]=RCTRL -keymap[0xE5]=RSHIFT -keymap[0xE6]=RALT -keymap[0xFF]=FN - -def keycode_lookup(key): - if key in keymap: - return keymap[key] - return -1 - diff --git a/firmware/python_modules/ekeyboard/platform.py b/firmware/python_modules/ekeyboard/platform.py deleted file mode 100644 index 14f3f1a..0000000 --- a/firmware/python_modules/ekeyboard/platform.py +++ /dev/null @@ -1,124 +0,0 @@ -import machine -from machine import UART, Timer - -keyboard_handler = [] -statusled_handler = [] - -RELEASED = 0 -PRESSED = 1 - -backlit_enabled = 1 -edgelit_enabled = 1 -keyboard_disabled = 0 - -def uart_callback(datastruct): - global keyboard_handler, statusled_handler - global backlit_enabled, edgelit_enabled, keyboard_disabled - #print(datastruct) - message = datastruct - if len(message) == 2: - message = bytes(message, "ascii") - command = int(message[0]) - payload = int(message[1]) - if command == 0x01: - backlit_enabled = (payload & 0x01) > 0 - edgelit_enabled = (payload & 0x02) > 0 - keyboard_disabled = (payload & 0x04) > 0 - elif command == 0x04: #release key - for handler in keyboard_handler: - try: - handler(RELEASED, payload) - except Exception as e: - import sys - print("Exception in handler") - sys.print_exception(e) - elif command == 0x05: #press key - for handler in keyboard_handler: - try: - handler(PRESSED, payload) - except Exception as e: - import sys - print("Exception in handler") - sys.print_exception(e) - elif command == 0x06: #led update - for handler in statusled_handler: - try: - handler(payload) - except Exception as e: - import sys - print("Exception in handler") - sys.print_exception(e) - -def receiver(tim): - if platform_uart.any() >= 2: - res = platform_uart.read(2) - uart_callback(res) - -def backlit_power(enable=True): - global platform_uart - if enable: - platform_uart.write(bytes([0x01, 0x01])) - else: - platform_uart.write(bytes([0x01, 0x00])) - -def backlit_status(): - global backlit_enabled, edgelit_enabled, keyboard_disabled - return backlit_enabled - -def edgelit_power(enable=True): - global platform_uart - if enable: - platform_uart.write(bytes([0x02, 0x01])) - else: - platform_uart.write(bytes([0x02, 0x00])) - -def edgelit_status(): - global backlit_enabled, edgelit_enabled, keyboard_disabled - return edgelit_enabled - -def usb_hid(enable=True): - global platform_uart - if enable: - platform_uart.write(bytes([0x03, 0x00])) - else: - platform_uart.write(bytes([0x03, 0x01])) - -def usb_disabled(): - global backlit_enabled, edgelit_enabled, keyboard_disabled - return keyboard_disabled - -def add_statusled_handler(handler): - global statusled_handler - statusled_handler.append(handler) - -def remove_statusled_handler(handler): - global statusled_handler - for index, _handler in statusled_handler: - if _handler == handler: - del statusled_handler[index] - break - -def add_keyboard_handler(handler): - global keyboard_handler - keyboard_handler.append(handler) - -def remove_keyboard_handler(handler): - global keyboard_handler - for index, _handler in keyboard_handler: - if _handler == handler: - del keyboard_handler[index] - break - -def force_update(): - platform_uart.write(bytes([0x04, 0x00])) - -platform_uart = machine.UART(1) -platform_uart.init(9600, tx=23, rx=22) -platform_uart.write(bytes([0, 0, 0, 0])) #Purge -platform_tim = Timer(3) -platform_tim.init(mode=Timer.PERIODIC, callback=receiver, freq=100, tick_hz=100) - -backlit_power() -edgelit_power() - -force_update() \ No newline at end of file diff --git a/firmware/python_modules/ekeyboard/term_menu.py b/firmware/python_modules/ekeyboard/term_menu.py deleted file mode 100644 index b1ab28c..0000000 --- a/firmware/python_modules/ekeyboard/term_menu.py +++ /dev/null @@ -1,66 +0,0 @@ -import term, system, version, consts - -class UartMenu(): - def __init__(self, gts, pm, safe = False, pol="Power off"): - self.gts = gts - self.menu = self.menu_main - self.buff = "" - self.pm = pm - self.power_off_label = pol - - def main(self): - if self.pm: - term.setPowerManagement(self.pm) - while self.menu: - self.menu() - - def drop_to_shell(self): - self.menu = False - term.clear() - import shell - - def menu_main(self): - items = ["Python shell", "Apps", "Installer", "Settings", "Tools", "Check for updates"] - if self.gts: - items.append(self.power_off_label) - callbacks = [self.drop_to_shell, self.opt_launcher, self.opt_installer, self.menu_settings, self.menu_tools, self.opt_ota_check, self.go_to_sleep] - message = "" - cb = term.menu("Main menu", items, 0, message) - self.menu = callbacks[cb] - return - - def go_to_sleep(self): - self.gts() - - def opt_change_nickname(self): - system.start("dashboard.terminal.nickname", True) - - def opt_installer(self): - system.start("dashboard.terminal.installer", True) - - def opt_launcher(self): - system.start("dashboard.terminal.launcher", True) - - def opt_configure_wifi(self): - system.start("dashboard.terminal.wifi", True) - - def opt_ota(self): - system.ota(True) - - def opt_ota_check(self): - system.start("dashboard.tools.update_firmware", True) - - def opt_downloader(self): - system.start("dashboard.terminal.downloader", True) - - def menu_settings(self): - items = ["Change nickname", "WiFi configuration", "Update firmware", "< Return to main menu"] - callbacks = [self.opt_change_nickname, self.opt_configure_wifi, self.opt_ota, self.menu_main, self.menu_main] - cb = term.menu("Settings", items) - self.menu = callbacks[cb] - - def menu_tools(self): - items = ["File downloader", "< Return to main menu"] - callbacks = [self.opt_downloader, self.menu_main, self.menu_main] - cb = term.menu("Tools", items) - self.menu = callbacks[cb] diff --git a/firmware/python_modules/ekeyboard/version.py b/firmware/python_modules/ekeyboard/version.py deleted file mode 100644 index 740ea92..0000000 --- a/firmware/python_modules/ekeyboard/version.py +++ /dev/null @@ -1,14 +0,0 @@ -import consts - -build = consts.INFO_FIRMWARE_BUILD -name = consts.INFO_FIRMWARE_NAME -badge_name = consts.INFO_HARDWARE_NAME -dialog_title = "Notice" -default_orientation = 0 - -font_header = "Roboto_Regular12" -font_default = "7x5" -font_nickname_large = "Roboto_Regular18" -font_nickname_small = "Roboto_Regular12" - -hatcheryurl = "https://"+consts.WOEZEL_WEB_SERVER diff --git a/firmware/sdkconfig b/firmware/sdkconfig.defaults similarity index 88% rename from firmware/sdkconfig rename to firmware/sdkconfig.defaults index 59b5515..87ce3f6 100644 --- a/firmware/sdkconfig +++ b/firmware/sdkconfig.defaults @@ -125,15 +125,15 @@ CONFIG_PARTITION_TABLE_MD5=y # CONFIG_INFO_FIRMWARE_NAME="Unknown" CONFIG_INFO_FIRMWARE_BUILD=0 -CONFIG_INFO_HARDWARE_NAME="EKeyboard" -CONFIG_MICROPY_FROZEN_MANIFEST="ekeyboard.py" -CONFIG_INFO_HARDWARE_WOEZEL_NAME="ekeyboard" -CONFIG_OTA_WEB_SERVER="ekeyboard.wittemanlabs.nl" +CONFIG_INFO_HARDWARE_NAME="Core" +CONFIG_MICROPY_FROZEN_MANIFEST="core.py" +CONFIG_INFO_HARDWARE_WOEZEL_NAME="core" +CONFIG_OTA_WEB_SERVER="" CONFIG_OTA_WEB_USE_HTTPS=y CONFIG_OTA_WEB_PORT=443 -CONFIG_OTA_WEB_PATH="/version/ekeyboard.bin" -CONFIG_OTA_WEB_VERSION_PATH="/version/ekeyboard.txt" -CONFIG_WOEZEL_WEB_SERVER="apps.wittemanlabs.nl" +CONFIG_OTA_WEB_PATH="" +CONFIG_OTA_WEB_VERSION_PATH="" +CONFIG_WOEZEL_WEB_SERVER="" CONFIG_WIFI_SSID="badge" CONFIG_WIFI_PASSWORD="" CONFIG_DEFAULT_DISPLAY_ORIENTATION_LANDSCAPE=y @@ -178,18 +178,102 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # # Bluetooth # -# CONFIG_BT_ENABLED is not set +CONFIG_BT_ENABLED=y + +# +# Bluetooth controller +# +CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y +# CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY is not set +# CONFIG_BTDM_CTRL_MODE_BTDM is not set +CONFIG_BTDM_CTRL_BLE_MAX_CONN=3 CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0 CONFIG_BTDM_CTRL_PCM_ROLE_EFF=0 CONFIG_BTDM_CTRL_PCM_POLAR_EFF=0 -CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=0 +CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=3 CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0 CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0 +CONFIG_BTDM_CTRL_PINNED_TO_CORE_0=y +# CONFIG_BTDM_CTRL_PINNED_TO_CORE_1 is not set CONFIG_BTDM_CTRL_PINNED_TO_CORE=0 +CONFIG_BTDM_CTRL_HCI_MODE_VHCI=y +# CONFIG_BTDM_CTRL_HCI_MODE_UART_H4 is not set + +# +# MODEM SLEEP Options +# +CONFIG_BTDM_MODEM_SLEEP=y +CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG=y +# CONFIG_BTDM_MODEM_SLEEP_MODE_EVED is not set +CONFIG_BTDM_LPCLK_SEL_MAIN_XTAL=y +# end of MODEM SLEEP Options + +CONFIG_BTDM_BLE_DEFAULT_SCA_250PPM=y CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1 -CONFIG_BT_RESERVE_DRAM=0 +CONFIG_BTDM_BLE_SCAN_DUPL=y +CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE=y +# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA is not set +# CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE is not set +CONFIG_BTDM_SCAN_DUPL_TYPE=0 +CONFIG_BTDM_SCAN_DUPL_CACHE_SIZE=200 +# CONFIG_BTDM_BLE_MESH_SCAN_DUPL_EN is not set +CONFIG_BTDM_CTRL_FULL_SCAN_SUPPORTED=y +CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y +CONFIG_BTDM_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 +CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +# CONFIG_BTDM_COEX_BT_OPTIONS is not set +# end of Bluetooth controller + +# CONFIG_BT_BLUEDROID_ENABLED is not set +CONFIG_BT_NIMBLE_ENABLED=y +# CONFIG_BT_CONTROLLER_ONLY is not set +CONFIG_BT_RESERVE_DRAM=0xdb5c + +# +# NimBLE Options +# +CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y +# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL is not set +# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set +CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3 +CONFIG_BT_NIMBLE_MAX_BONDS=3 +CONFIG_BT_NIMBLE_MAX_CCCDS=8 +CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM=0 +CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y +# CONFIG_BT_NIMBLE_PINNED_TO_CORE_1 is not set +CONFIG_BT_NIMBLE_PINNED_TO_CORE=0 +CONFIG_BT_NIMBLE_TASK_STACK_SIZE=4096 +CONFIG_BT_NIMBLE_ROLE_CENTRAL=y +CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y +CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y +CONFIG_BT_NIMBLE_ROLE_OBSERVER=y +CONFIG_BT_NIMBLE_NVS_PERSIST=y +CONFIG_BT_NIMBLE_SM_LEGACY=y +CONFIG_BT_NIMBLE_SM_SC=y +# CONFIG_BT_NIMBLE_DEBUG is not set +# CONFIG_BT_NIMBLE_SM_SC_DEBUG_KEYS is not set +CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" +CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 +CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=256 +CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE=0 +CONFIG_BT_NIMBLE_ACL_BUF_COUNT=12 +CONFIG_BT_NIMBLE_ACL_BUF_SIZE=255 +CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT=30 +CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT=8 +CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT=12 +CONFIG_BT_NIMBLE_HS_FLOW_CTRL=y +CONFIG_BT_NIMBLE_HS_FLOW_CTRL_ITVL=1000 +CONFIG_BT_NIMBLE_HS_FLOW_CTRL_THRESH=2 +CONFIG_BT_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT=y +CONFIG_BT_NIMBLE_RPA_TIMEOUT=900 +# CONFIG_BT_NIMBLE_MESH is not set +CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS=y +# end of NimBLE Options # end of Bluetooth +# CONFIG_BLE_MESH is not set + # # CoAP Configuration # @@ -364,7 +448,6 @@ CONFIG_ESP32_XTAL_FREQ_40=y # CONFIG_ESP32_XTAL_FREQ_AUTO is not set CONFIG_ESP32_XTAL_FREQ=40 # CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_ESP32_NO_BLOBS is not set # CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set # CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 @@ -430,7 +513,8 @@ CONFIG_ETH_RMII_CLK_IN_GPIO=0 CONFIG_ETH_DMA_BUFFER_SIZE=512 CONFIG_ETH_DMA_RX_BUFFER_NUM=10 CONFIG_ETH_DMA_TX_BUFFER_NUM=10 -# CONFIG_ETH_USE_SPI_ETHERNET is not set +CONFIG_ETH_USE_SPI_ETHERNET=y +# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set # CONFIG_ETH_USE_OPENETH is not set # end of Ethernet @@ -507,6 +591,7 @@ CONFIG_ESP_TIMER_IMPL_TG0_LAC=y # # Wi-Fi # +CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y @@ -634,7 +719,7 @@ CONFIG_FREERTOS_ISR_STACKSIZE=1536 # CONFIG_FREERTOS_LEGACY_HOOKS is not set CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set +CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP=y CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 @@ -679,11 +764,11 @@ CONFIG_HEAP_TASK_TRACKING=y # # CONFIG_LOG_DEFAULT_LEVEL_NONE is not set # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y +CONFIG_LOG_DEFAULT_LEVEL_WARN=y +# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -695,7 +780,7 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y CONFIG_LWIP_LOCAL_HOSTNAME="espressif" CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set -CONFIG_LWIP_IRAM_OPTIMIZATION=y +# CONFIG_LWIP_IRAM_OPTIMIZATION is not set CONFIG_LWIP_TIMERS_ONDEMAND=y CONFIG_LWIP_MAX_SOCKETS=10 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set @@ -1113,14 +1198,7 @@ CONFIG_WPA_MBEDTLS_CRYPTO=y # # Buses # -CONFIG_BUS_VSPI_ENABLE=y -CONFIG_PIN_NUM_VSPI_CLK=18 -CONFIG_PIN_NUM_VSPI_MOSI=23 -CONFIG_PIN_NUM_VSPI_MISO=35 -CONFIG_PIN_NUM_VSPI_WP=-1 -CONFIG_PIN_NUM_VSPI_HD=-1 -CONFIG_BUS_VSPI_DMA_CHANNEL=2 -CONFIG_BUS_VSPI_MAX_TRANSFERSIZE=4094 +# CONFIG_BUS_VSPI_ENABLE is not set # CONFIG_BUS_HSPI_ENABLE is not set # CONFIG_BUS_I2C0_ENABLE is not set # CONFIG_BUS_I2C1_ENABLE is not set @@ -1166,14 +1244,6 @@ CONFIG_BUS_VSPI_MAX_TRANSFERSIZE=4094 # # Driver: ILI9341 LCD display # -CONFIG_DRIVER_ILI9341_ENABLE=y -CONFIG_PIN_NUM_ILI9341_RESET=-1 -CONFIG_PIN_NUM_ILI9341_DCX=33 -CONFIG_PIN_NUM_ILI9341_CS=32 -CONFIG_PIN_NUM_ILI9341_BACKLIGHT=-1 -CONFIG_ILI9341_ORIENTATION=0 -# CONFIG_ILI9341_COLOR_SWAP is not set -# CONFIG_DRIVER_ILI9341_8C is not set # end of Driver: ILI9341 LCD display # @@ -1210,8 +1280,7 @@ CONFIG_ILI9341_ORIENTATION=0 # # Driver: framebuffer support # -CONFIG_DRIVER_FRAMEBUFFER_ENABLE=y -# CONFIG_DRIVER_FRAMEBUFFER_FLIP is not set +# CONFIG_DRIVER_FRAMEBUFFER_ENABLE is not set # CONFIG_DRIVER_FRAMEBUFFER_SWAP_R_AND_B is not set # CONFIG_DRIVER_FRAMEBUFFER_CORRECT_GAMMA is not set # CONFIG_DRIVER_FRAMEBUFFER_CORRECT_GB is not set @@ -1399,10 +1468,67 @@ CONFIG_STACK_CHECK_NONE=y # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=0 +CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY=y +# CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY is not set +# CONFIG_BTDM_CONTROLLER_MODE_BTDM is not set +CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 +CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0 CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 +CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y +# CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4 is not set +CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y +CONFIG_BLE_SCAN_DUPLICATE=y +CONFIG_SCAN_DUPLICATE_BY_DEVICE_ADDR=y +# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA is not set +# CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR is not set +CONFIG_SCAN_DUPLICATE_TYPE=0 +CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 +# CONFIG_BLE_MESH_SCAN_DUPLICATE_EN is not set +CONFIG_BTDM_CONTROLLER_FULL_SCAN_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_SUPPORTED=y +CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM=100 +CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 +# CONFIG_BLUEDROID_ENABLED is not set +CONFIG_NIMBLE_ENABLED=y +CONFIG_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y +# CONFIG_NIMBLE_MEM_ALLOC_MODE_EXTERNAL is not set +# CONFIG_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set +CONFIG_NIMBLE_MAX_CONNECTIONS=3 +CONFIG_NIMBLE_MAX_BONDS=3 +CONFIG_NIMBLE_MAX_CCCDS=8 +CONFIG_NIMBLE_L2CAP_COC_MAX_NUM=0 +CONFIG_NIMBLE_PINNED_TO_CORE_0=y +# CONFIG_NIMBLE_PINNED_TO_CORE_1 is not set +CONFIG_NIMBLE_PINNED_TO_CORE=0 +CONFIG_NIMBLE_TASK_STACK_SIZE=4096 +CONFIG_NIMBLE_ROLE_CENTRAL=y +CONFIG_NIMBLE_ROLE_PERIPHERAL=y +CONFIG_NIMBLE_ROLE_BROADCASTER=y +CONFIG_NIMBLE_ROLE_OBSERVER=y +CONFIG_NIMBLE_NVS_PERSIST=y +CONFIG_NIMBLE_SM_LEGACY=y +CONFIG_NIMBLE_SM_SC=y +# CONFIG_NIMBLE_DEBUG is not set +# CONFIG_NIMBLE_SM_SC_DEBUG_KEYS is not set +CONFIG_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" +CONFIG_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 +CONFIG_NIMBLE_ATT_PREFERRED_MTU=256 +CONFIG_NIMBLE_SVC_GAP_APPEARANCE=0 +CONFIG_NIMBLE_ACL_BUF_COUNT=12 +CONFIG_NIMBLE_ACL_BUF_SIZE=255 +CONFIG_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_NIMBLE_HCI_EVT_HI_BUF_COUNT=30 +CONFIG_NIMBLE_HCI_EVT_LO_BUF_COUNT=8 +CONFIG_NIMBLE_MSYS1_BLOCK_COUNT=12 +CONFIG_NIMBLE_HS_FLOW_CTRL=y +CONFIG_NIMBLE_HS_FLOW_CTRL_ITVL=1000 +CONFIG_NIMBLE_HS_FLOW_CTRL_THRESH=2 +CONFIG_NIMBLE_HS_FLOW_CTRL_TX_ON_DISCONNECT=y +CONFIG_NIMBLE_RPA_TIMEOUT=900 +# CONFIG_NIMBLE_MESH is not set +CONFIG_NIMBLE_CRYPTO_STACK_MBEDTLS=y CONFIG_ADC2_DISABLE_DAC=y CONFIG_SPIRAM_SUPPORT=y # CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is not set @@ -1428,7 +1554,6 @@ CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set # CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_NO_BLOBS is not set # CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 @@ -1457,6 +1582,7 @@ CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y # CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set # CONFIG_ESP32S2_PANIC_GDBSTUB is not set CONFIG_TIMER_TASK_STACK_SIZE=3584 +CONFIG_SW_COEXIST_ENABLE=y CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 CONFIG_MB_QUEUE_LENGTH=20 @@ -1473,7 +1599,7 @@ CONFIG_MB_TIMER_PORT_ENABLED=y CONFIG_MB_TIMER_GROUP=0 CONFIG_MB_TIMER_INDEX=0 CONFIG_SUPPORT_STATIC_ALLOCATION=y -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK=y CONFIG_TIMER_TASK_PRIORITY=1 CONFIG_TIMER_TASK_STACK_DEPTH=2048 CONFIG_TIMER_QUEUE_LENGTH=10