diff options
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 1 | ||||
| -rw-r--r-- | Scripts/generate_utils.py | 2 | ||||
| -rw-r--r-- | Scripts/osc_ctrl.py | 16 |
3 files changed, 17 insertions, 2 deletions
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index d9dcc18..9cfaeba 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -443,6 +443,7 @@ bool PythonWrapper::GenerateAnimator( } } + Log(out, "Done!\n"); return true; } diff --git a/Scripts/generate_utils.py b/Scripts/generate_utils.py index 6930782..349988d 100644 --- a/Scripts/generate_utils.py +++ b/Scripts/generate_utils.py @@ -18,7 +18,7 @@ class Config(): num_cells = self.BOARD_ROWS * self.BOARD_COLS layers_in_last_region = num_cells % self.CHARS_PER_SYNC float_result = num_cells / self.CHARS_PER_SYNC - if which_layer > layers_in_last_region: + if which_layer >= layers_in_last_region: return floor(float_result) else: return ceil(float_result) diff --git a/Scripts/osc_ctrl.py b/Scripts/osc_ctrl.py index 3b25778..7efd435 100644 --- a/Scripts/osc_ctrl.py +++ b/Scripts/osc_ctrl.py @@ -5,6 +5,7 @@ from generate_utils import config import generate_utils from paging import MultiLinePager from pythonosc import udp_client +from math import ceil import time # Based on a couple experiments, this seems like about as fast as we can go @@ -101,6 +102,19 @@ def pageMessage(osc_state: OscState, msg: str) -> bool: which_region = (slice_idx % generate_utils.config.numRegions(0)) print("send to region {}".format(which_region)) + # if in last region: + # how long is it + num_cells = generate_utils.config.BOARD_ROWS * generate_utils.config.BOARD_COLS + num_regions = ceil(num_cells / generate_utils.config.CHARS_PER_SYNC) + print("num regions: {}".format(num_regions)) + if which_region == num_regions - 1: + layers_in_last_region = num_cells % 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))) + enable(osc_state.client) # Seek to the current region. @@ -110,7 +124,7 @@ def pageMessage(osc_state: OscState, msg: str) -> bool: # Update each letter. encoded = encodeMessage(osc_state.encoding, msg_slice) print("len encoded: {}".format(len(encoded))) - for i in range(0, len(msg_slice)): + for i in range(0, len(encoded)): updateRegion(osc_state.client, i, encoded[i]) # Wait for parameter sync. |
