|
102 | 102 | <div class="flex justify-between items-center -mt-1"> |
103 | 103 | <v-checkbox |
104 | 104 | v-model="miniWidget.options.useVoltageToColor" |
105 | | - label="Use voltage to color scheme" |
| 105 | + label="Change color by voltage" |
106 | 106 | hide-details |
107 | 107 | class="mr-1" |
108 | 108 | /> |
109 | | - <v-tooltip |
110 | | - location="top" |
111 | | - text="Configure these voltage levels according to your battery pack. Defaults are based on Blue Robotics' 4S Li-ion battery pack." |
112 | | - > |
113 | | - <template #activator="{ props: infoProps }"> |
114 | | - <v-icon |
115 | | - v-bind="infoProps" |
116 | | - icon="mdi-information-outline" |
117 | | - class="ml-1 text-yellow-300 cursor-pointer" |
118 | | - size="18" |
119 | | - /> |
120 | | - </template> |
121 | | - </v-tooltip> |
| 109 | + <div class="flex items-center gap-x-1"> |
| 110 | + <v-tooltip |
| 111 | + location="top" |
| 112 | + text="Configure these voltage levels according to your battery pack. Defaults are based on Blue Robotics' 4S Li-ion battery pack." |
| 113 | + > |
| 114 | + <template #activator="{ props: infoProps }"> |
| 115 | + <v-icon |
| 116 | + v-bind="infoProps" |
| 117 | + icon="mdi-information-outline" |
| 118 | + class="ml-1 text-yellow-300 cursor-pointer" |
| 119 | + size="18" |
| 120 | + /> |
| 121 | + </template> |
| 122 | + </v-tooltip> |
| 123 | + <v-tooltip location="top" text="Reset colors and voltage thresholds to default values"> |
| 124 | + <template #activator="{ props: resetProps }"> |
| 125 | + <v-btn v-bind="resetProps" icon size="small" variant="text" class="text-white" @click="resetToDefaults"> |
| 126 | + <v-icon icon="mdi-restore" size="18" /> |
| 127 | + </v-btn> |
| 128 | + </template> |
| 129 | + </v-tooltip> |
| 130 | + </div> |
122 | 131 | </div> |
123 | 132 |
|
124 | 133 | <div class="flex items-start gap-x-2"> |
@@ -245,6 +254,11 @@ miniWidget.value.options.batteryThresholds ??= Object.assign({}, defaultBatteryL |
245 | 254 |
|
246 | 255 | const batteryThresholds = computed<BatteryLevelThresholds>(() => miniWidget.value.options.batteryThresholds) |
247 | 256 |
|
| 257 | +const resetToDefaults = (): void => { |
| 258 | + miniWidget.value.options.voltageToColorScheme = Object.assign({}, defaultBatteryLevelColorScheme) |
| 259 | + miniWidget.value.options.batteryThresholds = Object.assign({}, defaultBatteryLevelThresholds) |
| 260 | +} |
| 261 | +
|
248 | 262 | // Round voltage to 0.1V precision for values < 100V, integer precision for >= 100V |
249 | 263 | const roundedVoltage = computed(() => { |
250 | 264 | const voltage = store?.powerSupply?.voltage |
|
0 commit comments