mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-04 22:10:36 +08:00

### Maintenance page * Add add tab color for mobile view * Add spellcheck off / autocorect off in input * Add disconnect button when authenticate enabled * Add Invalid user or password message when authentication failed ### Board support * Add ESP32 S2 support * Add ESP32 S3 support * Add ESP32 C3 support ### ESP commands * Add command 701 to control GCODE streaming * Remove command 901 as duplicate * Update command 420 to add more details * Use text as default output * All json on all commands for formated output ### Core * Add benchmak function to check transfer speed (for test only-not production) * Merge code for ESP3DLib support * Add better printer display support (M117 / Serial TFT) * Use ESP32 analogWrite instead of emulated one ### Modules * Display * Refactor code * Remove SPI ILI 9341 / 9488 support as not suitable * Add ST7789 support (135x240 / 240x240) * Filesystem * Bug fixes due to esp core updates * Better SD sharing mecanism * Better global FS management * FTP * Add SD sharing support * Better global FS management * GCODE Host * Add basic support for macro files * Add ESP command support * Use not blocking method to stream commands / handle response * Notifications * Add IFTTT notification service * Add WebUI notification * Add ESP3D display notification * WebDav * Add SD sharing support * Add bug fix from https://github.com/d-a-v/ESPWebDAV * Better global FS management * Websocket * Add function to handle zombies connections * WiFi * Fix connection to AP sometime fail * Fix low signal not diplayed in ESP420 even connected * Add AP Setup mode ### Libraries * Update SDFat-2.0.6 to 2.1.2 * Update ESP32SSDP 1.1.1 to 1.2.0 * Update TFT_eSPI-1.4.11 to 2.4.61 * Update arduinoWebSockets-2.3.5 to 2.3.6 * Update esp8266-oled-ssd1306-4.0.0 to 4.3.0 * Remove lvgl support ### Tools * Add I2C scanner script * Add python script to simulate/stress printer serial communication ### PlatformIO * Use latest 4.4.0 Espressif32 release (ESP32-arduino core 2.0.3) * Add fix for Flash more than 4MB * Add Esp32 S2/S3/C3 env * Add ESP32-ST7789 / esp32-TTGO_T_Display env
99 lines
4.1 KiB
Python
99 lines
4.1 KiB
Python
import os
|
|
|
|
from docutils import nodes
|
|
from docutils.parsers.rst import Directive, directives
|
|
from docutils.parsers.rst.directives.images import Image
|
|
from sphinx.directives.code import LiteralInclude
|
|
|
|
|
|
def excluded_list(argument):
|
|
return argument.split(',')
|
|
|
|
|
|
|
|
|
|
class LvExample(Directive):
|
|
required_arguments = 1
|
|
option_spec = {
|
|
'excluded_languages': excluded_list,
|
|
'language': directives.unchanged,
|
|
'description': directives.unchanged
|
|
}
|
|
def get_example_code_path(self, example_path, language):
|
|
return os.path.abspath("../examples/" + example_path + "." + language)
|
|
def human_language_name(self, language):
|
|
if language == 'py':
|
|
return 'MicroPython'
|
|
elif language == 'c':
|
|
return 'C'
|
|
else:
|
|
return language
|
|
def github_path(self, example_path, language):
|
|
env = self.state.document.settings.env
|
|
return f"https://github.com/lvgl/lvgl/blob/{env.config.repo_commit_hash}/examples/{example_path}.{language}"
|
|
def embed_code(self, example_file, example_path, language, buttons={}):
|
|
toggle = nodes.container('', literal_block=False, classes=['toggle'])
|
|
header = nodes.container('', literal_block=False, classes=['header'])
|
|
toggle.append(header)
|
|
try:
|
|
with open(example_file) as f:
|
|
contents = f.read()
|
|
except FileNotFoundError:
|
|
contents = 'Error encountered while trying to open ' + example_file
|
|
literal_list = nodes.literal_block(contents, contents)
|
|
literal_list['language'] = language
|
|
toggle.append(literal_list)
|
|
paragraph_node = nodes.raw(text=f"<p>{self.human_language_name(language)} code </p>", format='html')
|
|
for text, url in buttons.items():
|
|
paragraph_node.append(nodes.raw(text=f"<a class='lv-example-link-button' onclick=\"event.stopPropagation();\" href='{url}'>{text}</a>", format='html'))
|
|
header.append(paragraph_node)
|
|
return toggle
|
|
def run(self):
|
|
example_path = self.arguments[0]
|
|
example_name = os.path.split(example_path)[1]
|
|
excluded_languages = self.options.get('excluded_languages', [])
|
|
node_list = []
|
|
|
|
env = self.state.document.settings.env
|
|
|
|
iframe_html = ""
|
|
|
|
c_path = self.get_example_code_path(example_path, 'c')
|
|
py_path = self.get_example_code_path(example_path, 'py')
|
|
|
|
c_code = self.embed_code(c_path, example_path, 'c', buttons={
|
|
'<i class="fa fa-github"></i> GitHub': self.github_path(example_path, 'c')
|
|
})
|
|
py_code = self.embed_code(py_path, example_path, 'py', buttons={
|
|
'<i class="fa fa-github"></i> GitHub': self.github_path(example_path, 'py'),
|
|
'<i class="fa fa-play"></i> Simulator': f"https://sim.lvgl.io/v{env.config.version}/micropython/ports/javascript/index.html?script_startup=https://raw.githubusercontent.com/lvgl/lvgl/{env.config.repo_commit_hash}/examples/header.py&script=https://raw.githubusercontent.com/lvgl/lvgl/{env.config.repo_commit_hash}/examples/{example_path}.py"
|
|
})
|
|
|
|
if not 'c' in excluded_languages:
|
|
if env.app.tags.has('html'):
|
|
iframe_html = f"<div class='lv-example' data-real-src='/{env.config.version}/_static/built_lv_examples?example={example_name}&w=320&h=240'></div>"
|
|
|
|
description_html = f"<div class='lv-example-description'>{self.options.get('description', '')}</div>"
|
|
layout_node = nodes.raw(text=f"<div class='lv-example-container'>{iframe_html}{description_html}</div>", format='html')
|
|
|
|
node_list.append(layout_node)
|
|
if not 'c' in excluded_languages:
|
|
node_list.append(c_code)
|
|
if not 'py' in excluded_languages:
|
|
node_list.append(py_code)
|
|
|
|
trailing_node = nodes.raw(text=f"<hr/>", format='html')
|
|
node_list.append(trailing_node)
|
|
|
|
return node_list
|
|
|
|
def setup(app):
|
|
app.add_directive("lv_example", LvExample)
|
|
app.add_config_value("repo_commit_hash", "", "env")
|
|
|
|
return {
|
|
'version': '0.1',
|
|
'parallel_read_safe': True,
|
|
'parallel_write_safe': True,
|
|
}
|