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

Improving hardwareId behavior #2335

Merged
merged 2 commits into from Dec 13, 2020

Conversation

asizon
Copy link
Member

@asizon asizon commented Dec 13, 2020

So now, hardwareId is disabled when flash finished or if Full erase chip is enabled. Also added flex functionality to fix hardwareId position.

image

@@ -775,6 +775,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
for (var j = 0; j < self.flash_layout.sectors[i].num_pages; j++) {
if (self.options.erase_chip) {
// full chip erase
$('span.hardwareId').hide();
Copy link
Member

Choose a reason for hiding this comment

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

I think the data driven approach is better - we want to reset the data (with FC.resetState()) when it becomes invalid (disconnect of the device), and not 'combat the symptoms' by hiding the element that displays cached invalid data.

Copy link
Member Author

Choose a reason for hiding this comment

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

@mikeller Yes, it makes sense, I wasn't really sure which was the best option, done!

Fix indendation

Add css changes

Change hiden to reset data aproach

Add semicolons
@@ -90,9 +90,6 @@ PortHandler.check_usb_devices = function (callback) {
callback(self.dfu_available);
}
if (!$('option:selected', self.portPickerElement).data().isDFU) {
if (!GUI.connected_to) {
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why you want to remove this - to me it seems to be the right approach to reset the FC state whenever a disconnect / change of the selected port is detected.

Copy link
Member Author

@asizon asizon Dec 13, 2020

Choose a reason for hiding this comment

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

Because when configurator reads hardwareId its not in Dfu mode, then it reset data and hardwareId never shown when is flashing. Im not sure how to fix this behavior.

Copy link
Member Author

@asizon asizon Dec 13, 2020

Choose a reason for hiding this comment

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

Maybe I can add a condition to aply only if not in flash progress

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I can see what you are trying to do - the current implementation is correct (because there is a disconnect when DFU mode is entered), but it is not super helpful, as the hardware id does not show during flashing.

Maybe I can add a condition to aply only if not in flash progress

Yes, I think this makes sense - if flashing is in progress then we know that a 'disconnect' is not a physical disconnect.

Copy link
Member Author

@asizon asizon Dec 13, 2020

Choose a reason for hiding this comment

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

I got it!Definitely I have removed the reset when chip erase is checked, as you said in the past it can be usefull if the user selects wrong target.

@@ -775,6 +775,7 @@ STM32DFU_protocol.prototype.upload_procedure = function (step) {
for (var j = 0; j < self.flash_layout.sectors[i].num_pages; j++) {
if (self.options.erase_chip) {
// full chip erase
FC.resetState();
Copy link
Member

Choose a reason for hiding this comment

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

Calling a high level function from inside a protocol implementation is problematic - especially since this is happening only in a very specific code path. If this is really the correct approach, it will have to be done with a callback.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okey im going to look at this because I think this is the correct approach to can show hide hardwareId when is really needed.

@sonarcloud
Copy link

sonarcloud bot commented Dec 13, 2020

Kudos, SonarCloud 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

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.

None yet

2 participants