diff -Naur ../2021_02_01/module/edit_mode.c ./module/edit_mode.c --- ../2021_02_01/module/edit_mode.c 2021-02-01 20:24:57.000000000 +0100 +++ ./module/edit_mode.c 2021-02-01 20:25:25.958554101 +0100 @@ -402,13 +402,80 @@ if (dirty & D_INPUT) { bool muted = false; - char prefix = script + '1'; - if (script == METRO_SCRIPT) { - prefix = 'M'; + //char prefix = script + '1'; + char prefix[3] = " "; + if (script == METRO_SCRIPT) { + //prefix = 'M'; + strcpy(prefix, "M"); muted = !scene_state.variables.m_act; } else if (script == INIT_SCRIPT) - prefix = 'I'; + //prefix = 'I'; + strcpy(prefix, "I"); + else if (script == TT_SCRIPT_1) { + strcpy(prefix, "1"); + } + else if (script == TT_SCRIPT_2) { + strcpy(prefix, "2"); + } + else if (script == TT_SCRIPT_3) { + strcpy(prefix, "3"); + } + else if (script == TT_SCRIPT_4) { + strcpy(prefix, "4"); + } + else if (script == TT_SCRIPT_5) { + strcpy(prefix, "5"); + } + else if (script == TT_SCRIPT_6) { + strcpy(prefix, "6"); + } + else if (script == TT_SCRIPT_7) { + strcpy(prefix, "7"); + } + else if (script == TT_SCRIPT_8) { + strcpy(prefix, "8"); + } + else if (script == TT_SCRIPT_11) { + //prefix = 'A'; + strcpy(prefix, "11"); + muted = true; + } + else if (script == TT_SCRIPT_12) { + //prefix = 'B'; + strcpy(prefix, "12"); + muted = true; + } + else if (script == TT_SCRIPT_13) { + //prefix = 'C'; + strcpy(prefix, "13"); + muted = true; + } + else if (script == TT_SCRIPT_14) { + //prefix = 'D'; + strcpy(prefix, "14"); + muted = true; + } + else if (script == TT_SCRIPT_15) { + //prefix = 'E'; + strcpy(prefix, "15"); + muted = true; + } + else if (script == TT_SCRIPT_16) { + //prefix = 'F'; + strcpy(prefix, "16"); + muted = true; + } + else if (script == TT_SCRIPT_17) { + //prefix = 'H'; + strcpy(prefix, "17"); + muted = true; + } + else if (script == TT_SCRIPT_18) { + //prefix = 'J'; + strcpy(prefix, "18"); + muted = true; + } else if (script <= TT_SCRIPT_8) muted = ss_get_mute(&scene_state, script); @@ -417,8 +484,8 @@ else region_fill(&line[7], 0); - char script_no[2] = { prefix, '\0' }; - font_string_region_clip(&line[7], script_no, 0, 0, + //char script_no[2] = { prefix, '\0' }; + font_string_region_clip(&line[7], prefix, 0, 0, muted ? 4 : 15, 0); screen_dirty |= (1 << 7); diff -Naur ../2021_02_01/module/flash.h ./module/flash.h --- ../2021_02_01/module/flash.h 2021-02-01 20:24:57.000000000 +0100 +++ ./module/flash.h 2021-02-01 20:25:25.958554101 +0100 @@ -7,7 +7,7 @@ #include "line_editor.h" #include "teletype.h" -#define SCENE_SLOTS 32 +#define SCENE_SLOTS 24 u8 is_flash_fresh(void); void flash_prepare(void); diff -Naur ../2021_02_01/module/line_editor.c ./module/line_editor.c --- ../2021_02_01/module/line_editor.c 2021-02-01 20:24:57.000000000 +0100 +++ ./module/line_editor.c 2021-02-01 20:25:25.958554101 +0100 @@ -180,3 +180,16 @@ region_fill(reg, 0); font_string_region_clip_hid(reg, s, 0, 0, 0xf, 0, le->cursor + 2, 3); } + +void line_editor_draw2(line_editor_t *le, char *prefix, region *reg) { + // LINE_EDITOR_SIZE includes space for null, need to also include space for + // the prefix, the space after the prefix and a space at the very end + char s[LINE_EDITOR_SIZE + 3]; + strcpy(s, prefix); + strcat(s, " "); + strcat(s, le->buffer); + strcat(s, " "); + + region_fill(reg, 0); + font_string_region_clip_hid(reg, s, 0, 0, 0xf, 0, le->cursor + 2, 3); +} diff -Naur ../2021_02_01/module/line_editor.h ./module/line_editor.h --- ../2021_02_01/module/line_editor.h 2021-02-01 20:24:57.000000000 +0100 +++ ./module/line_editor.h 2021-02-01 20:25:25.958554101 +0100 @@ -22,4 +22,5 @@ bool line_editor_process_keys(line_editor_t *le, uint8_t key, uint8_t mod_key, bool is_key_held); void line_editor_draw(line_editor_t *le, char prefix, region *reg); +void line_editor_draw2(line_editor_t *le, char *prefix, region *reg); #endif diff -Naur ../2021_02_01/module/main.c ./module/main.c --- ../2021_02_01/module/main.c 2021-02-01 20:24:57.000000000 +0100 +++ ./module/main.c 2021-02-01 20:28:16.145337391 +0100 @@ -407,9 +407,13 @@ else if (mode == M_PRESET_R && !(grid_connected && grid_control_mode)) { uint8_t preset = adc[1] >> 6; uint8_t deadzone = preset & 1; - preset >>= 1; - if (!deadzone || abs(preset - get_preset()) > 1) + preset >>= 1; + + if (!deadzone || abs(preset - get_preset()) > 1){ + // atte: stop selection at SCENE_SLOTS, was hardcoded to 32... + preset = (preset < SCENE_SLOTS ? preset : (SCENE_SLOTS - 1)); process_preset_r_preset(preset); + } } else { ss_set_param(&scene_state, adc[1] << 2); @@ -884,6 +888,11 @@ run_script(&scene_state, k - HID_F1); return true; } + // shift- through : run scripts (11-18) + else if (mod_only_shift(m) && k >= HID_F1 && k <= HID_F8) { + run_script(&scene_state, k - HID_F1 + 10); + return true; + } // alt- through alt-: edit corresponding script // alt-: edit metro script // alt-: edit init script @@ -892,6 +901,12 @@ set_mode(M_EDIT); return true; } + // alt-shift- through shift-alt-: edit scripts (11-18) + else if (mod_only_shift_alt(m) && k >= HID_F1 && k <= HID_F8) { + set_edit_mode_script(k - HID_F1 + 10); + set_mode(M_EDIT); + return true; + } // ctrl- through ctrl- mute triggers else if (mod_only_ctrl(m) && k >= HID_F1 && k <= HID_F8) { bool muted = ss_get_mute(&scene_state, (k - HID_F1)); diff -Naur ../2021_02_01/module/usb_disk_mode.c ./module/usb_disk_mode.c --- ../2021_02_01/module/usb_disk_mode.c 2021-02-01 20:24:57.000000000 +0100 +++ ./module/usb_disk_mode.c 2021-02-01 20:25:25.962554101 +0100 @@ -121,7 +121,7 @@ } char input[36]; - for (int s = 0; s < 10; s++) { + for (int s = 0; s < 18; s++) { file_putc('\n'); file_putc('\n'); file_putc('#'); @@ -129,6 +129,22 @@ file_putc('M'); else if (s == 9) file_putc('I'); + else if (s == 10) + file_putc('A'); + else if (s == 11) + file_putc('B'); + else if (s == 12) + file_putc('C'); + else if (s == 13) + file_putc('D'); + else if (s == 14) + file_putc('E'); + else if (s == 15) + file_putc('F'); + else if (s == 16) + file_putc('H'); + else if (s == 17) + file_putc('J'); else file_putc(s + 49); @@ -261,11 +277,27 @@ s = 8; else if (c == 'I') s = 9; - else if (c == 'P') + else if (c == 'A') s = 10; + else if (c == 'B') + s = 11; + else if (c == 'C') + s = 12; + else if (c == 'D') + s = 13; + else if (c == 'E') + s = 14; + else if (c == 'F') + s = 15; + else if (c == 'H') + s = 16; + else if (c == 'J') + s = 17; + else if (c == 'P') + s = 18; else if (c == 'G') { grid_state = grid_num = grid_count = 0; - s = 11; + s = 19; } else { s = c - 49; @@ -298,7 +330,7 @@ } } // SCRIPTS - else if (s >= 0 && s <= 9) { + else if (s >= 0 && s <= 17) { if (c == '\n') { if (p && l < SCRIPT_MAX_COMMANDS) { tele_command_t temp; @@ -342,7 +374,7 @@ } // PATTERNS // tele_patterns[]. l wrap start end v[64] - else if (s == 10) { + else if (s == 18) { if (c == '\n' || c == '\t') { if (b < 4) { if (l > 3) { @@ -375,7 +407,8 @@ if (c == '\n') { if (p) l++; - if (l > 68) s = -1; + // atte: 64 + 4????? + if (l > PATTERN_LENGTH + 4) s = -1; b = 0; p = 0; } @@ -392,7 +425,7 @@ } } // GRID - else if (s == 11) { + else if (s == 19) { grid_usb_read(&scene, c); } } diff -Naur ../2021_02_01/src/ops/controlflow.c ./src/ops/controlflow.c --- ../2021_02_01/src/ops/controlflow.c 2021-02-01 20:24:57.000000000 +0100 +++ ./src/ops/controlflow.c 2021-02-01 20:25:25.962554101 +0100 @@ -242,7 +242,7 @@ static void op_SCRIPT_set(const void *NOTUSED(data), scene_state_t *ss, exec_state_t *es, command_state_t *cs) { uint16_t a = cs_pop(cs) - 1; - if (a > INIT_SCRIPT || a < TT_SCRIPT_1) return; + if (a > TT_SCRIPT_18 || a < TT_SCRIPT_1) return; es_push(es); // an overflow causes all future SCRIPT calls to fail @@ -271,7 +271,7 @@ } else { uint8_t s = a - 1; - if (s >= TT_SCRIPT_1 && s <= TT_SCRIPT_8) { + if (s >= TT_SCRIPT_1 && s <= TT_SCRIPT_18) { ss_set_script_pol(ss, s, pol); } } diff -Naur ../2021_02_01/src/state.h ./src/state.h --- ../2021_02_01/src/state.h 2021-02-01 20:24:57.000000000 +0100 +++ ./src/state.h 2021-02-01 20:25:25.962554101 +0100 @@ -22,7 +22,7 @@ #define PATTERN_COUNT 4 #define PATTERN_LENGTH 64 #define SCRIPT_MAX_COMMANDS 6 -#define SCRIPT_COUNT 11 +#define SCRIPT_COUNT 19 #define EXEC_DEPTH 8 #define WHILE_DEPTH 10000 #define RAND_STATES_COUNT 5 diff -Naur ../2021_02_01/src/turtle.h ./src/turtle.h --- ../2021_02_01/src/turtle.h 2021-02-01 20:24:57.000000000 +0100 +++ ./src/turtle.h 2021-02-01 20:25:25.962554101 +0100 @@ -41,6 +41,14 @@ TT_SCRIPT_8, METRO_SCRIPT, INIT_SCRIPT, + TT_SCRIPT_11, + TT_SCRIPT_12, + TT_SCRIPT_13, + TT_SCRIPT_14, + TT_SCRIPT_15, + TT_SCRIPT_16, + TT_SCRIPT_17, + TT_SCRIPT_18, TEMP_SCRIPT } script_number_t;