v.0.10.0 redesign prj structure, multi dev containers

This commit is contained in:
tiijay
2025-11-20 11:50:19 +00:00
parent 53b1b96fb3
commit 76a8203458
52 changed files with 63 additions and 83 deletions

View File

@@ -1,19 +0,0 @@
#!/usr/bin/fish
echo "=== MicroPython Deployment Script ==="
# Check if app directory exists
if not test -d "app"
echo "Error: 'app' directory not found!"
exit 1
end
echo "1. Copying app directory to device..."
mpremote connect port:rfc2217://localhost:4000 cp -r app :
mpremote connect port:rfc2217://localhost:4000 mkdir restapi
mpremote connect port:rfc2217://localhost:4000 cp restapi/*.json :restapi/
echo "2. Starting main.py..."
mpremote connect port:rfc2217://localhost:4000 run main.py
echo "=== Deployment Complete ==="

View File

@@ -1,26 +0,0 @@
{
"version": 1,
"author": "RGB Matrix Pico W Project",
"editor": "wokwi",
"parts": [
{
"type": "board-pi-pico-w",
"id": "picow",
"top": 1014.35,
"left": 3.55
},
{
"type": "wokwi-led-matrix",
"id": "matrix",
"top": -617.6,
"left": 1.1,
"attrs": { "rows": "64", "cols": "64", "pixels": "[]" }
}
],
"connections": [
["matrix:VDD", "picow:VBUS", "red", ["v96", "h-91.4"]],
["matrix:VSS", "picow:GND.8", "black", ["v0"]],
["matrix:DIN", "picow:GP28", "green", ["v0"]]
],
"dependencies": {}
}

View File

@@ -22,7 +22,8 @@
"kevinrose.vsc-python-indent", "kevinrose.vsc-python-indent",
"wayou.vscode-todo-highlight", "wayou.vscode-todo-highlight",
"charliermarsh.ruff", "charliermarsh.ruff",
"wokwi.wokwi-vscode" "wokwi.wokwi-vscode",
"humao.rest-client"
] ]
} }
}, },
@@ -37,7 +38,7 @@
} }
}, },
// Use 'postCreateCommand' to run commands after the container is created. // Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pip3 install -r requirements.txt" "postCreateCommand": "pip3 install -r requirements.txt",
// "postCreateCommand": "apt-get update && apt-get install -y git && pip3 install -r requirements.txt" // "postCreateCommand": "apt-get update && apt-get install -y git && pip3 install -r requirements.txt"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root" // "remoteUser": "root"

25
pico-client/deploy.fish Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/fish
echo "=== MicroPython Deployment Script ==="
echo "1. Create pico-client directories on device..."
mpremote connect port:rfc2217://localhost:4000 mkdir restapi
mpremote connect port:rfc2217://localhost:4000 mkdir classes
mpremote connect port:rfc2217://localhost:4000 mkdir display
mpremote connect port:rfc2217://localhost:4000 mkdir tryout
mpremote connect port:rfc2217://localhost:4000 mkdir utils
mpremote connect port:rfc2217://localhost:4000 mkdir web
echo "1. Copying pico-client directories to device..."
mpremote connect port:rfc2217://localhost:4000 cp -r restapi/mock :
mpremote connect port:rfc2217://localhost:4000 cp -r classes :
mpremote connect port:rfc2217://localhost:4000 cp -r display :
mpremote connect port:rfc2217://localhost:4000 cp -r tryout :
mpremote connect port:rfc2217://localhost:4000 cp -r utils :
mpremote connect port:rfc2217://localhost:4000 cp -r web :
echo "2. Starting main.py..."
mpremote connect port:rfc2217://localhost:4000 run main.py
echo "=== Deployment Complete ==="

View File

@@ -1,10 +1,10 @@
from machine import Pin # type: ignore from machine import Pin # type: ignore
from neopixel import NeoPixel # type: ignore from neopixel import NeoPixel # type: ignore
from app.utils import char_width from utils import char_width
from app.display import fonts from display import fonts
from app.utils import colors from utils import colors
from app.utils.time_utils import ( from utils.time_utils import (
get_german_timestamp_short, get_german_timestamp_short,
get_datetime_string, get_datetime_string,
get_german_time_ticks, get_german_time_ticks,

View File

@@ -1,17 +1,17 @@
from app.display import NeoPixel_64x64 from display import NeoPixel_64x64
from app.display.fonts import font_5x7 from display.fonts import font_5x7
from app.tryout import Font_Checker, Weather_Checker, Emoji_Checker from tryout import Font_Checker, Weather_Checker, Emoji_Checker
from app.utils import show_system_load from utils import show_system_load
from app.utils import ( from utils import (
sync_ntp_time, sync_ntp_time,
get_datetime_string, get_datetime_string,
get_german_datetime, get_german_datetime,
) # Time-related functions ) # Time-related functions
from app.utils import SimpleCounter, colors from utils import SimpleCounter, colors
import time import time
from app.utils.digital_clock import DigitalClock from utils.digital_clock import DigitalClock
import uasyncio as asyncio # type: ignore import uasyncio as asyncio # type: ignore
from app.web import Wlan from web import Wlan
CITY_LIST: list[str] = sorted( CITY_LIST: list[str] = sorted(
["Großhansdorf", "Columbus", "London", "Ebeltoft", "Tokio"] ["Großhansdorf", "Columbus", "London", "Ebeltoft", "Tokio"]

View File

@@ -1,9 +1,9 @@
from app.display import NeoPixel_64x64 from display import NeoPixel_64x64
from app.display.emoji import emoji_8x8, emoji_16x16 from display.emoji import emoji_8x8, emoji_16x16
from app.utils import colors from utils import colors
class Emoji_Checker():
class Emoji_Checker:
def __init__(self, display: NeoPixel_64x64): def __init__(self, display: NeoPixel_64x64):
self.display = display self.display = display
@@ -12,8 +12,8 @@ class Emoji_Checker():
# try emoji # try emoji
self.display.set_font(emoji_8x8) self.display.set_font(emoji_8x8)
self.display.write_text('😀😂✅😎💙', 0, 0, color=colors.GREEN) self.display.write_text("😀😂✅😎💙", 0, 0, color=colors.GREEN)
# try emoji # try emoji
self.display.set_font(emoji_16x16) self.display.set_font(emoji_16x16)
self.display.write_text('🌙💙🔑', 0, 10, color=colors.ORANGE) self.display.write_text("🌙💙🔑", 0, 10, color=colors.ORANGE)

View File

@@ -1,11 +1,11 @@
from app.display import NeoPixel_64x64 from display import NeoPixel_64x64
from app.utils import align_font, colors from utils import align_font, colors
import app.display.fonts as fonts import display.fonts as fonts
class Font_Checker():
class Font_Checker:
font = fonts.font_3x5 font = fonts.font_3x5
def __init__(self, display: NeoPixel_64x64): def __init__(self, display: NeoPixel_64x64):
self.display = display self.display = display
@@ -14,28 +14,27 @@ class Font_Checker():
print(pretty_font) print(pretty_font)
def fonts_check(self, pretty=False) -> None: def fonts_check(self, pretty=False) -> None:
for fnt in fonts.fonts_installed: for fnt in fonts.fonts_installed:
self.display.clear() self.display.clear()
self.display.set_font(fnt) self.display.set_font(fnt)
height = self.display.font_height height = self.display.font_height
alphanum: str = ''.join(sorted(self.font.keys())) alphanum: str = "".join(sorted(self.font.keys()))
text_left = alphanum text_left = alphanum
while text_left: while text_left:
# Text entsprechend des Display splitten # Text entsprechend des Display splitten
scr_txt_dict = self.display.screen_text(text=text_left) scr_txt_dict = self.display.screen_text(text=text_left)
print(f'scr_txt: {scr_txt_dict}') print(f"scr_txt: {scr_txt_dict}")
self.display.clear() self.display.clear()
for idx, row_text in enumerate(scr_txt_dict['visible']): for idx, row_text in enumerate(scr_txt_dict["visible"]):
ypos = height * idx ypos = height * idx
# display.clear_row(ypos) # display.clear_row(ypos)
self.display.write_text(row_text, 0, ypos, colors.RAINBOW[idx % 6]) self.display.write_text(row_text, 0, ypos, colors.RAINBOW[idx % 6])
text_left = scr_txt_dict['invisible'] text_left = scr_txt_dict["invisible"]
if pretty: if pretty:
self.font_pretty(self.font) self.font_pretty(self.font)

View File

@@ -1,16 +1,16 @@
import urequests # type: ignore import urequests # type: ignore
import json import json
from app.classes import ( from classes import (
Weather, Weather,
Location, Location,
CurrentCondition, CurrentCondition,
WeatherResponse, WeatherResponse,
ResponseStatus, ResponseStatus,
) )
from app.display import NeoPixel_64x64 from display import NeoPixel_64x64
import app.utils.colors as colors import utils.colors as colors
from app.utils import URLEncoder, http_message, get_datetime_string from utils import URLEncoder, http_message, get_datetime_string
API_KEY = "3545ce42d0ba436e8dc164532250410" API_KEY = "3545ce42d0ba436e8dc164532250410"
ACTUAL_WEATHER_URL = "http://api.weatherapi.com/v1/current.json?key={API_KEY}&q={city}&aqi=yes&lang={lang}" ACTUAL_WEATHER_URL = "http://api.weatherapi.com/v1/current.json?key={API_KEY}&q={city}&aqi=yes&lang={lang}"

View File

@@ -1,6 +1,6 @@
from app.display.neopixel_64x64 import NeoPixel_64x64 from display.neopixel_64x64 import NeoPixel_64x64
from app.utils import get_datetime_string, text_width, find_first_mismatch from utils import get_datetime_string, text_width, find_first_mismatch
from app.utils import colors from utils import colors
class DigitalClock: class DigitalClock: