-
-
Notifications
You must be signed in to change notification settings - Fork 895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert battery icon to vue component #2726
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Seems to be working, just need to fix one little issue where is shows it's empty battery when connected to usb (might be issue which was there before as well, but need to do some manual verification) |
This comment has been minimized.
This comment has been minimized.
</div> | ||
</template> | ||
<script> | ||
const NO_BATTERY_VOLTAGE_MAXIMUM = 1.8; // Maybe is better to add a call to MSP_BATTERY_STATE but is not available for all versions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only as suggestion... now that you have refactored it... maybe we can get rid of this, now that the code is clean...
We need to call this MSP:
betaflight-configurator/src/js/msp/MSPHelper.js
Lines 307 to 318 in d0d3141
case MSPCodes.MSP_BATTERY_STATE: | |
FC.BATTERY_STATE.cellCount = data.readU8(); | |
FC.BATTERY_STATE.capacity = data.readU16(); // mAh | |
FC.BATTERY_STATE.voltage = data.readU8() / 10.0; // V | |
FC.BATTERY_STATE.mAhDrawn = data.readU16(); // mAh | |
FC.BATTERY_STATE.amperage = data.readU16() / 100; // A | |
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_41)) { | |
FC.BATTERY_STATE.batteryState = data.readU8(); | |
FC.BATTERY_STATE.voltage = data.readU16() / 100; | |
} | |
break; |
and pass the FC.BATTERY_STATE.batteryState to the component. The value will be:
It can be null or undefined (I'm not too sure) if the firmware is old, in this case we need to use the same code than now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will grab a look at it 😉 thanks for suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configurator now only supports >= API_VERSION_1_42
1938686
to
b0ea89d
Compare
This comment has been minimized.
This comment has been minimized.
b0ea89d
to
c5811f8
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This comment has been minimized.
This comment has been minimized.
c5811f8
to
277686c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
/** | ||
* 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; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving out for better visibility and easier usage with no less.
This comment has been minimized.
This comment has been minimized.
AUTOMERGE: (FAIL)
|
8b5c70f
to
c79676c
Compare
@haslinghuis fixed now |
This comment has been minimized.
This comment has been minimized.
c79676c
to
46e26da
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Do you want to test this code? Here you have an automated build: |
Convert battery icon logic to self contained vue component.