Skip to content

Conversation

@sensei-hacker
Copy link
Member

@sensei-hacker sensei-hacker commented Jan 30, 2026

User description

Summary

Fixes JavaScript ReferenceError: GUI_control is not defined that on magnetometer tab, firmware flasher and serial connection flows.

Changes

Changed 4 instances across 3 files from incorrect GUI_control.prototype.log() to correct GUI.log():

  • tabs/magnetometer.js:653 - Magnetometer 3D initialization error message
  • tabs/firmware_flasher.js:829 - Firmware flasher connection error logging
  • js/serial_backend.js:348, 416 - Serial connection restart-required and API version error logging

Root Cause

Code was calling GUI_control.prototype.log() (the constructor prototype method) instead of using the exported singleton instance GUI.log(). All other tabs in the codebase correctly use GUI.log() - these 4 locations were inconsistent with the established pattern.


PR Type

Bug fix


Description

  • Fix ReferenceError by replacing GUI_control.prototype.log() with GUI.log()

  • Corrects 4 instances across 3 files to use singleton pattern

  • Affects magnetometer, firmware flasher, and serial backend modules

  • Aligns code with established GUI logging pattern throughout codebase


Diagram Walkthrough

flowchart LR
  A["GUI_control.prototype.log<br/>incorrect calls"] -->|"Replace with"| B["GUI.log<br/>singleton instance"]
  B --> C["js/serial_backend.js<br/>2 instances"]
  B --> D["tabs/firmware_flasher.js<br/>1 instance"]
  B --> E["tabs/magnetometer.js<br/>1 instance"]
Loading

File Walkthrough

Relevant files
Bug fix
serial_backend.js
Fix GUI logging calls in serial backend                                   

js/serial_backend.js

  • Changed GUI_control.prototype.log() to GUI.log() at line 348 for
    restart-required error message
  • Changed GUI_control.prototype.log() to GUI.log() at line 416 for API
    version error message
  • Both changes fix ReferenceError in serial connection error handling
    paths
+2/-2     
firmware_flasher.js
Fix GUI logging in firmware flasher                                           

tabs/firmware_flasher.js

  • Changed GUI_control.prototype.log() to GUI.log() at line 829 for
    target prefetch error message
  • Fixes ReferenceError when API version check fails during firmware
    flashing
+1/-1     
magnetometer.js
Fix GUI logging in magnetometer tab                                           

tabs/magnetometer.js

  • Changed GUI_control.prototype.log() to GUI.log() at line 653 for mixer
    configuration error message
  • Fixes ReferenceError during 3D magnetometer initialization when mixer
    is not configured
+1/-1     

Fixes JavaScript ReferenceError where code was calling
GUI_control.prototype.log() instead of GUI.log().

GUI_control is a constructor function, while GUI is the
exported singleton instance that should be used throughout
the codebase.

Changed 4 instances in 3 files:
- tabs/magnetometer.js:653 - Magnetometer 3D initialization
- tabs/firmware_flasher.js:829 - Firmware flasher error logging
- js/serial_backend.js:348,416 - Serial connection error logging

All other tabs correctly use GUI.log(). This fix brings
these files in line with the established pattern.

Fixes #11xxx (magnetometer tab initialization error)
@qodo-code-review
Copy link
Contributor

ⓘ Your approaching your monthly quota for Qodo. Upgrade your plan

PR Compliance Guide 🔍

All compliance sections have been disabled in the configurations.

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.

1 participant