summaryrefslogtreecommitdiffstats
path: root/Scripts/osc_ctrl.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2022-12-30 02:25:50 -0800
committeryum <yum.food.vr@gmail.com>2022-12-30 02:33:07 -0800
commitd9a0224466189d0fe1d46f21d586fa8a1a58c687 (patch)
tree3431bad18d46b7bdbad91caa508cb65f859f0276 /Scripts/osc_ctrl.py
parent7bc6ee5f7f163b35e9de0a368406978d144be5c5 (diff)
Bugfix: regions truncate correctly at page boundaries
Boards whose size is an even multiple of CHARS_PER_SYNC would lose the entire last region. * Attempt to fix runaway memory usage of GUI text frames, but this needs more work
Diffstat (limited to 'Scripts/osc_ctrl.py')
-rw-r--r--Scripts/osc_ctrl.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Scripts/osc_ctrl.py b/Scripts/osc_ctrl.py
index 422d854..7c7d0ae 100644
--- a/Scripts/osc_ctrl.py
+++ b/Scripts/osc_ctrl.py
@@ -100,7 +100,6 @@ def pageMessage(osc_state: OscState, msg: str) -> bool:
# Really long messages just wrap back around.
which_region = (slice_idx % generate_utils.config.numRegions(0))
- #print("send to region {}".format(which_region))
# if in last region:
# how long is it
@@ -109,12 +108,16 @@ def pageMessage(osc_state: OscState, msg: str) -> bool:
#print("num regions: {}".format(num_regions))
if which_region == num_regions - 1:
layers_in_last_region = num_cells % generate_utils.config.CHARS_PER_SYNC
+ if layers_in_last_region == 0:
+ layers_in_last_region = generate_utils.config.CHARS_PER_SYNC
#print("layers in last region: {}".format(layers_in_last_region))
old_len = len(msg_slice)
msg_slice = msg_slice[0:layers_in_last_region]
#print("truncate msg_slice from length {} to length {}".format(old_len,
# len(msg_slice)))
+ #print("send \"{}\" to region {}".format(msg_slice, which_region))
+
enable(osc_state.client)
# Seek to the current region.