diff --git a/.storybook/preview.js b/.storybook/preview.js
index d2cf053b3e..33de77bc03 100644
--- a/.storybook/preview.js
+++ b/.storybook/preview.js
@@ -50,7 +50,7 @@ export const decorators = [
template: `
-
+
`,
diff --git a/src/components/init.js b/src/components/init.js
index 0c36dad9a8..43240e40ee 100644
--- a/src/components/init.js
+++ b/src/components/init.js
@@ -10,6 +10,7 @@ import vueI18n from "./vueI18n.js";
import BatteryLegend from "./quad-status/BatteryLegend.vue";
import BetaflightLogo from "./betaflight-logo/BetaflightLogo.vue";
import StatusBar from "./status-bar/StatusBar.vue";
+import BatteryIcon from "./quad-status/BatteryIcon.vue";
// Most of the global objects can go here at first.
// It's a bit of overkill for simple components,
@@ -38,6 +39,7 @@ i18next.on('initialized', function() {
BatteryLegend,
BetaflightLogo,
StatusBar,
+ BatteryIcon,
},
data: betaflightModel,
});
diff --git a/src/components/quad-status/BatteryIcon.stories.js b/src/components/quad-status/BatteryIcon.stories.js
new file mode 100644
index 0000000000..78dba340d1
--- /dev/null
+++ b/src/components/quad-status/BatteryIcon.stories.js
@@ -0,0 +1,32 @@
+import BatteryIcon from "./BatteryIcon.vue";
+
+// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
+export default {
+ title: "Battery Icon",
+ component: BatteryIcon,
+};
+
+// More on component templates: https://storybook.js.org/docs/vue/writing-stories/introduction#using-args
+const Template = (_args, { argTypes }) => ({
+ props: Object.keys(argTypes),
+ components: { BatteryIcon },
+ template: '',
+});
+
+export const OK = Template.bind({});
+OK.args = {
+ voltage: 16,
+ vbatmincellvoltage: 3.7,
+ vbatmaxcellvoltage: 4.2,
+ vbatwarningcellvoltage: 3.8,
+};
+export const Warning = Template.bind({});
+Warning.args = {
+ ...OK.args,
+ voltage: 15.1,
+};
+export const Empty = Template.bind({});
+Empty.args = {
+ ...OK.args,
+ voltage: 14,
+};
diff --git a/src/components/quad-status/BatteryIcon.vue b/src/components/quad-status/BatteryIcon.vue
new file mode 100644
index 0000000000..510be6d8f9
--- /dev/null
+++ b/src/components/quad-status/BatteryIcon.vue
@@ -0,0 +1,136 @@
+
+
+
+
+
+
diff --git a/src/components/quad-status/BatteryLegend.stories.js b/src/components/quad-status/BatteryLegend.stories.js
index 86920d5386..3d77e30964 100644
--- a/src/components/quad-status/BatteryLegend.stories.js
+++ b/src/components/quad-status/BatteryLegend.stories.js
@@ -1,8 +1,8 @@
-import BatteryLegend from './BatteryLegend.vue';
+import BatteryLegend from "./BatteryLegend.vue";
// More on default export: https://storybook.js.org/docs/vue/writing-stories/introduction#default-export
export default {
- title: 'Battery Legend',
+ title: "Battery Legend",
component: BatteryLegend,
};
diff --git a/src/css/main.less b/src/css/main.less
index 801a6e892a..bc8ebfb5ee 100644
--- a/src/css/main.less
+++ b/src/css/main.less
@@ -1,37 +1,3 @@
-
-@keyframes error-blinker {
- 0% {
- background-color: transparent;
- }
- 50% {
- background-color: var(--error);
- }
-}
-
-&:root {
- --accent: #ffbb00;
- --error: red;
- --subtleAccent: silver;
- --quietText: #ffffff;
- --quietHeader: #828885;
- --defaultText: #000000;
- --subtleText: #c0c0c0;
- --mutedText: #616161;
- --linkText: #2e2ebb;
- --boxBackground: #ffffff;
- --alternativeBackground: #f9f9f9;
- --sideBackground: #ffffff;
- --ledAccent: #adadad;
- --ledBackground: #e9e9e9;
- --gimbalBackground: #eee;
- --gimbalCrosshair: var(--subtleAccent);
- --switcherysecond: #c4c4c4;
- --pushedButton-background: #c4c4c4;
- --pushedButton-fontColor: #000000;
- --hoverButton-background: #ffcc3e;
- --superSubtleAccent: #CCCCCC;
- --accentBorder: #ffbb00;
-}
* {
margin: 0;
padding: 0;
@@ -621,46 +587,7 @@ input[type="number"] {
text-shadow: 0 1px rgba(0, 0, 0, 1.0);
white-space: nowrap;
}
-.quad-status-contents {
- display: none;
- margin-top: 10px;
- margin-left: 14px;
- height: 10px;
- width: 31px;
- progress {
- &::-webkit-progress-bar {
- height: 12px;
- background-color: #eee;
- }
- &::-webkit-progress-value {
- background-color: #bcf;
- }
- }
-}
-.battery-status {
- height: 11px;
-}
-.battery-status.state-ok {
- background-color: #59AA29;
-}
-.battery-status.state-warning {
- background-color: var(--error);
-}
-.battery-status.state-empty {
- animation: error-blinker 1s linear infinite;
-}
-.battery-icon {
- background-image: url(../images/icons/cf_icon_bat_grey.svg);
- background-size: contain;
- background-position: center;
- display: inline-block;
- height: 30px;
- width: 60px;
- transition: none;
- margin-top: 4px;
- margin-left: -4px;
- background-repeat: no-repeat;
-}
+
.armedicon {
margin-left: 8px;
margin-right: 8px;
diff --git a/src/css/theme.css b/src/css/theme.css
new file mode 100644
index 0000000000..d6b01facfb
--- /dev/null
+++ b/src/css/theme.css
@@ -0,0 +1,29 @@
+/**
+ * Main theme colors
+ * This file is left as css on purpose to make it easier to work without
+ * the need to compile the less files and still can be use in storybook
+ */
+:root {
+ --accent: #ffbb00;
+ --error: red;
+ --subtleAccent: silver;
+ --quietText: #ffffff;
+ --quietHeader: #828885;
+ --defaultText: #000000;
+ --subtleText: #c0c0c0;
+ --mutedText: #616161;
+ --linkText: #2e2ebb;
+ --boxBackground: #ffffff;
+ --alternativeBackground: #f9f9f9;
+ --sideBackground: #ffffff;
+ --ledAccent: #adadad;
+ --ledBackground: #e9e9e9;
+ --gimbalBackground: #eee;
+ --gimbalCrosshair: var(--subtleAccent);
+ --switcherysecond: #c4c4c4;
+ --pushedButton-background: #c4c4c4;
+ --pushedButton-fontColor: #000000;
+ --hoverButton-background: #ffcc3e;
+ --superSubtleAccent: #cccccc;
+ --accentBorder: #ffbb00;
+}
diff --git a/src/js/serial_backend.js b/src/js/serial_backend.js
index 99cf50b2dc..0ca16828ea 100644
--- a/src/js/serial_backend.js
+++ b/src/js/serial_backend.js
@@ -659,10 +659,6 @@ async function getStatus() {
async function update_live_status() {
const statuswrapper = $('#quad-status_wrapper');
- $(".quad-status-contents").css({
- display: 'inline-block',
- });
-
if (GUI.active_tab !== 'cli' && GUI.active_tab !== 'presets') {
await MSP.promise(MSPCodes.MSP_BOXNAMES);
await getStatus();
diff --git a/src/main.html b/src/main.html
index 83b1adc071..ce3edb70de 100644
--- a/src/main.html
+++ b/src/main.html
@@ -7,6 +7,7 @@
+
@@ -184,12 +185,15 @@