Simvar global variable not found with toolbar panel

It looks like the simvar global variable is no longer defined when used from a toolbar panel. As a result, we can’t get/set any sim variable from a toolbar panel.
I have a toolbar panel for our GTN750 but the debugger reports an error about the simvar global variable not found. There was no such error in 2020.
Do I have to include some other specific JS file? Where the global simvar variable is defined?

2 Likes

Ok, after investigation, the issue comes from this line in the BaseInstrument constructor:

this.circuitAvionicsOnRegId = SimVar.GetRegisteredId(“CIRCUIT AVIONICS ON”, “Bool”, ‘’);

At constructor time, the simvar global variable is not set so the constructor fails.

I have removed this line and changed the isElectricityAvailable function to that:

isElectricityAvailable() {
    if (this.electricalLogic) {
        return this.electricalLogic.getValue() != 0;
    }
    return SimVar.GetSimVarValue("CIRCUIT AVIONICS ON", "Bool");
}

That works now.