Skip to content

Commit 20705e3

Browse files
committed
Initial python/uPython version
1 parent e7595cb commit 20705e3

68 files changed

Lines changed: 23923 additions & 4 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

frontend/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="/site_logo_mid.png" />
5+
<link rel="icon" href="/assets/site_logo_mid.png" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#000000" />
88
<meta

frontend/public/assets/darkly.min.css

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/public/assets/flatly.min.css

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/App.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const registerEventSource = dispatch => {
2929
return () => es.close()
3030
}
3131

32-
const DarkMode = () => <link rel="stylesheet" type="text/css" href='darkly.min.css' />;
33-
const LightMode = () => <link rel="stylesheet" type="text/css" href='flatly.min.css' />;
32+
const DarkMode = () => <link rel="stylesheet" type="text/css" href='/assets/darkly.min.css' />;
33+
const LightMode = () => <link rel="stylesheet" type="text/css" href='/assets/flatly.min.css' />;
3434

3535
function App() {
3636
const dispatch = useDispatch();

frontend/src/AppNavbar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const AppNavbar = () => {
1919
const navbarBg = darkMode ? 'dark' : 'light'
2020
const dispatch = useDispatch();
2121
return <Navbar expand='lg' className="bg-body-tertiary px-4" bg={navbarBg} data-bs-theme={navbarBg} collapseOnSelect={true}>
22-
<Navbar.Brand><img src='/site_logo_mid.png' width={48} height={48} alt='AstroPowerBox' className='me-3' /> AstroPowerBox</Navbar.Brand>
22+
<Navbar.Brand><img src='/assets/site_logo_mid.png' width={48} height={48} alt='AstroPowerBox' className='me-3' /> AstroPowerBox</Navbar.Brand>
2323
<Navbar.Toggle />
2424
<Navbar.Collapse>
2525
<Nav variant='tabs' className='me-auto'>

upython/.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PATH="$PWD/.venv/bin:$PATH"

upython/board.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import sys
2+
from config import Config
3+
import typing
4+
if typing.TYPE_CHECKING:
5+
from protocols.wifi_manager import WiFiManager
6+
import protocols.config_storage
7+
if sys.implementation.name == 'micropython':
8+
if sys.platform == 'esp32':
9+
import uasyncio as asyncio
10+
from boards.esp32.wifi_manager import ESPWiFiManager as WiFiManager
11+
from boards.esp32.config_storage import ESPConfigStorage as ConfigStorage
12+
else:
13+
raise RuntimeError('Unsupported micropython platform')
14+
elif sys.implementation.name == 'cpython':
15+
import os
16+
import asyncio
17+
from boards.cpython.json_config_storage import JsonConfigStorage as ConfigStorage
18+
if os.environ.get('SIMULATOR', '0') == '1':
19+
from boards.simulator.wifi_manager import SimulatorWiFiManager as WiFiManager
20+
else:
21+
raise RuntimeError(f'Unsupported python platform: {sys.implementation.name}')
22+
23+
class Board:
24+
config_storage: protocols.config_storage.ConfigStorage
25+
config: Config
26+
wifi_manager: WiFiManager
27+
28+
def __init__(self):
29+
self.config_storage = ConfigStorage()
30+
self.config = Config(self.config_storage)
31+
self.wifi_manager = WiFiManager(self.config)
32+
33+
34+

0 commit comments

Comments
 (0)