Skip to content
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

Merged
merged 3 commits into from
Jan 6, 2023

Conversation

chmelevskij
Copy link
Member

@chmelevskij chmelevskij commented Dec 31, 2021

Convert battery icon logic to self contained vue component.

Screenshot 2022-12-30 at 20 25 52

Screenshot 2022-12-30 at 20 25 46

Screenshot 2022-12-30 at 20 25 41

@chmelevskij chmelevskij changed the title Feat/quad status vue Convert battery icon to vue component Dec 31, 2021
@sonarcloud
Copy link

sonarcloud bot commented Dec 31, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@chmelevskij chmelevskij marked this pull request as draft December 31, 2021 15:29
@chmelevskij
Copy link
Member Author

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)

@github-actions

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
Copy link
Member

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:

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:

https://github.com/betaflight/betaflight/blob/025ee87a7aca068e3659fd066b8a9afbed123361/src/main/sensors/battery.h#L84-L90

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.

Copy link
Member Author

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

Copy link
Member

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

@github-actions

This comment has been minimized.

@sonarcloud
Copy link

sonarcloud bot commented May 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@chmelevskij chmelevskij marked this pull request as ready for review December 30, 2022 19:25
Comment on lines +1 to +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;
}
Copy link
Member Author

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.

@haslinghuis haslinghuis added this to the 10.9.0 milestone Dec 30, 2022
@haslinghuis haslinghuis added RN: UI and removed Pinned labels Dec 30, 2022
@github-actions

This comment has been minimized.

@blckmn
Copy link
Member

blckmn commented Dec 30, 2022

AUTOMERGE: (FAIL)

  • github identifies PR as mergeable -> FAIL
  • assigned to a milestone -> PASS
  • cooling off period lapsed -> PASS
  • commit count less or equal to three -> PASS
  • Don't merge label NOT found -> PASS
  • at least one RN: label found -> PASS
  • Tested label found -> PASS
  • assigned to an approver -> PASS
  • approver count at least three -> FAIL

@haslinghuis
Copy link
Member

Testing now but Configurator does not start?

image

@chmelevskij
Copy link
Member Author

@haslinghuis fixed now

@github-actions

This comment has been minimized.

@sonarcloud
Copy link

sonarcloud bot commented Dec 31, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link
Contributor

Do you want to test this code? Here you have an automated build:
Betaflight-Configurator-Android
Betaflight-Configurator-Linux
Betaflight-Configurator-macOS
Betaflight-Configurator-Windows
WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

@blckmn blckmn merged commit e0209c6 into betaflight:master Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants