Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/components/InstrumentControls/Camera.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
v-model="filter_wheel_options_selection"
placeholder="select filter..."
size="is-small"
:disabled="auto_color_options_selection !== 'manual'"
>
<option
v-for="(filter, index) in filter_wheel_options"
Expand All @@ -137,6 +138,29 @@
</b-field>
</b-field>

<b-field
v-if="auto_color_options.length > 1"
horizontal
label="Auto-Color"
>
<b-field>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this tag necessary?

<b-select
v-model="auto_color_options_selection"
placeholder="auto-color..."
size="is-small"
>
<option
v-for="(color_opt, index) in auto_color_options"
:key="index"
:value="color_opt"
:selected="index === 0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary because the default selection is already defined through the v-model setting.

>
{{ color_opt }}
</option>
</b-select>
</b-field>
</b-field>

<!--b-field horizontal label="Bin" v-if="camera_can_bin">
<b-select placeholder="Select bin" v-model="camera_bin" size="is-small">
<option
Expand Down Expand Up @@ -418,6 +442,11 @@ export default {
set (val) { this.$store.commit('command_params/filter_wheel_options_selection', val) }
},

auto_color_options_selection: {
get () { return this.$store.getters['command_params/auto_color_options_selection'] },
set (val) { this.$store.commit('command_params/auto_color_options_selection', val) }
},

selector_position: {
get () { return this.$store.getters['command_params/selector_position'] },
set (val) { this.$store.commit('command_params/selector_position', val) }
Expand Down
3 changes: 3 additions & 0 deletions src/mixins/commands_mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export const commands_mixin = {
// (eg. what filters are available in the filter wheel)
'camera_areas',
'filter_wheel_options',
'auto_color_options',
'camera_bin_options',
'camera_can_bin'
]),
Expand Down Expand Up @@ -308,6 +309,7 @@ export const commands_mixin = {
'camera_de_ice_cooling',

'filter_wheel_options_selection',
'auto_color_options_selection',

'selector_position',

Expand Down Expand Up @@ -431,6 +433,7 @@ export const commands_mixin = {
count: this.camera_count.toString(),
bin: JSON.stringify(this.camera_bin),
filter: this.filter_wheel_options_selection,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might make more sense to not include the filter if auto_color is set to something besides manual. It maps to reality a little better, but it does make the code a little more complicated. So I'm not 100% sold in either direction. Thoughts?

auto_color: this.auto_color_options_selection,
area: this.camera_areas_selection,
dither: this.camera_dither,
extract: this.camera_extract,
Expand Down
3 changes: 3 additions & 0 deletions src/store/modules/command_params.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const state = {
camera_de_ice_cooling: false,

filter_wheel_options_selection: '',
auto_color_options_selection: 'manual',

selector_position: 0, // the chosen inst. selector position.

Expand Down Expand Up @@ -87,6 +88,7 @@ const getters = {
camera_de_ice_cooling: state => state.camera_de_ice_cooling,

filter_wheel_options_selection: state => state.filter_wheel_options_selection,
auto_color_options_selection: state => state.auto_color_options_selection,

selector_position: state => state.selector_position,

Expand Down Expand Up @@ -161,6 +163,7 @@ const mutations = {
camera_de_ice_cooling (state, val) { state.camera_de_ice_cooling = val },

filter_wheel_options_selection (state, val) { state.filter_wheel_options_selection = val },
auto_color_options_selection (state, val) { state.auto_color_options_selection = val },

selector_position (state, val) { state.selector_position = val },

Expand Down
7 changes: 7 additions & 0 deletions src/store/modules/site_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ const getters = {
return fwo
},

// Available automatic 3-color image options
auto_color_options: (state, getters) => {
const fwo = getters.selected_filter_wheel_config.settings?.auto_color_options
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwo (from the method above) refers to filter wheel options (admittedly not a fantastic name). I think a different name here would help future readability.

if (fwo == undefined) return [[]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally a good idea to use the strict equality operator === to check if something is undefined. The loose equality check == will equate undefined and null, which usually isn't intended behavior. (I know, my mistake in the method above too.)

Also, while the filter wheel options expects a different format (the first array element is an array of keys, so an empty value still needs one element). But the auto_color_options is just a simple array of values. So the empty value should just be a simple [] rather than [[]].

return fwo
},

// Get the site events from the selected config (things like nautical dark start, etc)
site_events: (state, getters) => {
return getters.site_config.events ?? {}
Expand Down