You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
small tweaks
This commit is contained in:
@@ -10,8 +10,9 @@ from nostr.message_type import ClientMessageType
|
||||
|
||||
#filters = Filters([Filter(authors=[<a nostr pubkey in hex>], kinds=[EventKind.TEXT_NOTE])])
|
||||
#filters = Filters([Filter(authors="04c915daefee38317fa734444acee390a8269fe5810b2241e5e6dd343dfbecc9", kinds=[EventKind.TEXT_NOTE])])
|
||||
#timestamp = round(time.time()-10)
|
||||
timestamp = round(time.time()-100)
|
||||
timestamp = round(time.time()-10)
|
||||
#timestamp = round(time.time()) # going for zero events to check memory use
|
||||
#timestamp = round(time.time()-100)
|
||||
#timestamp = round(time.time()-1000)
|
||||
#timestamp = round(time.time()-5000)
|
||||
#filters = Filters([Filter(authors="04c915daefee38317fa734444acee390a8269fe5810b2241e5e6dd343dfbecc9", kinds=[9735], since=timestamp)])
|
||||
@@ -26,20 +27,24 @@ message = json.dumps(request)
|
||||
print(f"sending this: {message}")
|
||||
|
||||
def printevents():
|
||||
|
||||
print("relaymanager")
|
||||
relay_manager = RelayManager()
|
||||
time.sleep(3)
|
||||
#relay_manager.add_relay("wss://nostr-pub.wellorder.net")
|
||||
print("relaymanager adding")
|
||||
relay_manager.add_relay("wss://relay.damus.io")
|
||||
time.sleep(3)
|
||||
print("relaymanager subscribing")
|
||||
relay_manager.add_subscription(subscription_id, filters)
|
||||
time.sleep(2) # allow the connections to open
|
||||
time.sleep(3) # allow the connections to open
|
||||
|
||||
print("opening connections") # after this, CPU usage goes high and stays there
|
||||
relay_manager.open_connections({"cert_reqs": ssl.CERT_NONE}) # NOTE: This disables ssl certificate verification
|
||||
time.sleep(2) # allow the connections to open
|
||||
time.sleep(10) # allow the connections to open
|
||||
|
||||
print("publishing:")
|
||||
relay_manager.publish_message(message)
|
||||
time.sleep(2) # allow the messages to send
|
||||
time.sleep(10) # allow the messages to send
|
||||
|
||||
print("printing events:")
|
||||
#while relay_manager.message_pool.has_events():
|
||||
@@ -55,7 +60,23 @@ def printevents():
|
||||
relay_manager.close_connections()
|
||||
|
||||
# new thread so REPL stays available
|
||||
_thread.stack_size(32*1024)
|
||||
# 12KB crashes here:
|
||||
# opening connections
|
||||
# [DEBUG 408724546] Starting run_forever
|
||||
# [DEBUG 408724546] Starting _async_main
|
||||
# [DEBUG 408724546] Reconnect interval set to 0s
|
||||
# [DEBUG 408724546] Started callback processing task
|
||||
# [DEBUG 408724546] Main loop iteration: self.running=True
|
||||
# [DEBUG 408724546] Connecting to wss://relay.damus.io
|
||||
# [DEBUG 408724547] Using SSL with no certificate verification
|
||||
# 24KB is fine
|
||||
_thread.stack_size(18*1024)
|
||||
_thread.start_new_thread(printevents, ())
|
||||
#printevents()
|
||||
|
||||
|
||||
import gc
|
||||
for _ in range(50):
|
||||
collect = gc.collect()
|
||||
print(f"MEMFREE: {gc.mem_free()}")
|
||||
time.sleep(1)
|
||||
|
||||
@@ -48,7 +48,7 @@ print("sending it")
|
||||
#wsapp.send_text('["REQ","index3",{"kinds":[9735]}]')
|
||||
#wsapp.send_text('["REQ","index3",{"kinds":[9735], "since": 1745086888}]')
|
||||
tosend = '["REQ","index3",{"kinds":[9735], "since": '
|
||||
tosend += str(round(time.time()-500))
|
||||
tosend += str(round(time.time()-100))
|
||||
#tosend += str(round(time.time()-2000))
|
||||
#tosend += str(round(time.time()-10000))
|
||||
tosend += '}]'
|
||||
|
||||
@@ -30,17 +30,20 @@ if [ "$target" == "esp32" ]; then
|
||||
# --dual-core-threads: disabled GIL, run code on both CPUs
|
||||
# --task-stack-size={stack size in bytes}
|
||||
# CONFIG_* sets ESP-IDF options
|
||||
# listing processes on the esp32:
|
||||
# listing processes on the esp32 still doesn't work because no esp32.vtask_list_threads() or something
|
||||
# CONFIG_FREERTOS_USE_TRACE_FACILITY=y
|
||||
# CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y
|
||||
# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
|
||||
#python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE="/home/user/sources/micropython-camera-API/src/micropython.cmake" CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y "$manifest"
|
||||
python3 make.py --ota --partition-size=4194304 --flash-size=16 esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=cst816s USER_C_MODULE="/home/user/sources/micropython-camera-API/src/micropython.cmake" CONFIG_FREERTOS_USE_TRACE_FACILITY=y CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y "$manifest"
|
||||
else
|
||||
elif [ "$target" == "unix" -o "$target" == "macos" ]; then
|
||||
if [ "$buildtype" == "prod" ]; then
|
||||
manifest="FROZEN_MANIFEST=/home/user/sources/PiggyOS/manifest_unix.py"
|
||||
fi
|
||||
# build for desktop
|
||||
python3 make.py "$target" DISPLAY=sdl_display INDEV=sdl_pointer INDEV=sdl_keyboard "$manifest"
|
||||
else
|
||||
echo "invalid target $target"
|
||||
fi
|
||||
|
||||
popd
|
||||
|
||||
Reference in New Issue
Block a user