Skip to content

Commit

Permalink
Fix logic error in snapshot load/save.
Browse files Browse the repository at this point in the history
  • Loading branch information
istnv committed Aug 19, 2023
1 parent 7e75b9e commit 9f8df8d
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 130 deletions.
39 changes: 32 additions & 7 deletions actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,32 @@ export function buildStaticActions(self) {
},

load_snap: {
name: 'Load Console Snapshot',
name: 'Snapshot: Load',
options: [
{
type: 'textinput',
label: 'Snapshot Number 1-64',
id: 'snap',
default: '1',
useVariables: true,
},
],
callback: async (action, context) => {
const snap = parseInt(await context.parseVariablesInString(action.options.snap))
if (snap < 1 || snap > 64) {
const err = [action.controlId, action.actionId, 'Invalid Snapshot #'].join(' → ')
self.updateStatus(InstanceStatus.BadConfig, err)
self.paramError = true
} else {
self.updateStatus(InstanceStatus.Ok)
self.paramError = false
await sendOSCCmd('/-snap/load', { type: 'i', value: snap })
}
},
},

save_snap_num: {
name: 'Snapshot: Save',
options: [
{
type: 'textinput',
Expand All @@ -175,16 +200,16 @@ export function buildStaticActions(self) {
},

next_snap: {
name: 'Load Next Console Snapshot',
name: 'Snapshot: Load Next',
options: [],
callback: async (action, context) => {
const opt = action.options
await sendOSCCmd('/-snap/load', { type: 'i', value: parseInt(opt.snap) })
const snap = Math.min(++self.currentSnapshot, 64)
await sendOSCCmd('/-snap/load', { type: 'i', value: snap })
},
},

prev_snap: {
name: 'Load Prior Console Snapshot',
name: 'Snapshot: Load Prior',
options: [],
callback: async (action, context) => {
const snap = Math.max(--self.currentSnapshot, 1)
Expand All @@ -193,10 +218,10 @@ export function buildStaticActions(self) {
},

save_snap: {
name: 'Save Current Console Snapshot',
name: 'Snapshot: Save Current',
options: [],
callback: async (action, context) => {
const snap = Math.min(--self.currentSnapshot, 1)
const snap = self.currentSnapshot
await sendOSCCmd('/-snap/save', { type: 'i', value: snap })
},
},
Expand Down
6 changes: 3 additions & 3 deletions buildStripDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ export function buildStripDefs(self) {
color: combineRgb(255, 255, 255),
bgcolor: combineRgb(128, 0, 0),
},
callback: function (feedback, context) {
callback: (feedback, context) => {
const theChannel = feedback.options.theChannel
const fbWhich = feedback.feedbackId
const state = feedback.options.state != '0'
Expand Down Expand Up @@ -770,7 +770,7 @@ export function buildStripDefs(self) {
color: combineRgb(192, 192, 192),
bgcolor: combineRgb(0, 92, 128),
},
callback: function (feedback, context) {
callback: (feedback, context) => {
const theChannel = feedback.options.theChannel
const fbWhich = feedback.feedbackId
const state = feedback.options.state != '0'
Expand Down Expand Up @@ -807,7 +807,7 @@ export function buildStripDefs(self) {
name: 'Color of ' + fbDescription,
description: 'Use button colors from ' + fbDescription,
options: [],
callback: function (feedback, context) {
callback: (feedback, context) => {
const theChannel = feedback.options.theChannel
const fbWhich = feedback.feedbackId
let stat
Expand Down
9 changes: 5 additions & 4 deletions companion/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ Solo Level Adjust | Adjust the Solo level up or down by steps **see notes*
Solo Dim | Dims the Solo output level to the value configured in the console.
Solo Mute | Mutes the Solo output
Solo Mono | Controls the Mono mix-down of the Solo output
Load Console Snapshot | Loads the given Snapshot from the consoles internal Snapshot list 1-64
Load Previous Snapshot | Loads the previous (numerical) snapshot **see notes*
Load Next Snapshot | Loads the next (numerical) snapshot **see notes*
Save Current Snapshot | Saves/overwrites the current snapshot (NO CONFIRMATION) **see notes*
Snapshot: Load | Loads the given Snapshot from the console internal Snapshot list 1-64
Snapshot: Save | Save the given Snapshot to the console internal Snapshot list 1-64
Snapshot: Load Previous | Loads the previous (numerical) snapshot **see notes*
Snapshot: Load Next | Loads the next (numerical) snapshot **see notes*
Snapshot: Save Current | Saves/overwrites/updates the current snapshot (NO CONFIRMATION) **see notes*
Tape Operation | Stop,Play,PlayPause,Record,RecordPause,Fast Forward,Rewind of the tape Deck

**Note *mute, solo, processing*:** All mute, solo, and processing actions also have a Toggle option that inverts the current state of the board setting.
Expand Down
Loading

0 comments on commit 9f8df8d

Please sign in to comment.