You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
update mpong
This commit is contained in:
@@ -6,6 +6,9 @@ MOD = mpong
|
||||
# Source files (.c or .py)
|
||||
SRC = mpong.c
|
||||
|
||||
# Link runtime libraries (needed for memset on xtensawin)
|
||||
LINK_RUNTIME = 1
|
||||
|
||||
# Architectures to build for (x86, x64, armv6m, armv7m, xtensa, xtensawin, rv32imc, rv64imc)
|
||||
ARCHES = x64 xtensawin
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#. /home/user/projects/MicroPythonOS/claude/.espressif/python_env/idf5.4_py3.11_env/bin/activate
|
||||
. ~/.espressif/python_env/idf5.4_py3.11_env/bin/activate
|
||||
|
||||
mydir=$(readlink -f "$0")
|
||||
mydir=$(dirname "$mydir")
|
||||
@@ -10,4 +10,4 @@ rm *.mpy
|
||||
|
||||
PATH=~/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/:$PATH make </dev/null
|
||||
|
||||
mv mpong*.mpy ../../internal_filesystem/apps/com.micropythonos.mpong/assets/
|
||||
mv mpong*.mpy "$mydir"/../../internal_filesystem/apps/com.micropythonos.mpong/assets/
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
// Include the header file to get access to the MicroPython API
|
||||
#include "py/dynruntime.h"
|
||||
|
||||
// Provide a local memset for xtensawin native modules (libc isn't linked).
|
||||
void *memset(void *s, int c, size_t n) {
|
||||
unsigned char *p = (unsigned char *)s;
|
||||
while (n--) {
|
||||
*p++ = (unsigned char)c;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// Global BSS (non-static) state is required for native modules.
|
||||
uint16_t *g_framebuffer;
|
||||
size_t g_framebuffer_len;
|
||||
|
||||
@@ -65,7 +65,7 @@ class MPong(Activity):
|
||||
def onResume(self, screen):
|
||||
lv.log_register_print_cb(self.log_callback)
|
||||
mpong.init(self.buffer, self.hor_res, self.ver_res)
|
||||
self.refresh_timer = lv.timer_create(self.run_mpong, 15, None)
|
||||
self.refresh_timer = lv.timer_create(self.run_mpong, 30, None)
|
||||
|
||||
def onPause(self, screen):
|
||||
if self.refresh_timer:
|
||||
@@ -97,7 +97,7 @@ class MPong(Activity):
|
||||
focused = focusgroup.get_focused()
|
||||
if focused:
|
||||
#print(f"got focus button: {focused}")
|
||||
label = focused.get_child(0)
|
||||
#label = focused.get_child(0)
|
||||
#print(f"got label for button: {label.get_text()}")
|
||||
#focused.remove_state(lv.STATE.FOCUSED) # this doesn't seem to work to remove focus
|
||||
#print("checking which button is focused")
|
||||
@@ -114,6 +114,7 @@ class MPong(Activity):
|
||||
def run_mpong(self, timer=None):
|
||||
mpong.render()
|
||||
self.canvas.invalidate() # force redraw
|
||||
self.canvas.center()
|
||||
|
||||
def touch_cb(self, event):
|
||||
event_code = event.get_code()
|
||||
|
||||
Reference in New Issue
Block a user