Wave Wave Developer Docs

Battery Manager

Per-model battery profiles β€” name, chemistry, capacity, cycle count, accumulated flight time β€” plus the hardware auto-tracking setup that goes with them. Two halves to this page: reading what's currently configured, the way the built-in Battery Manager screens themselves do it, and calling signals to add, rename, select, share, reset, or reconfigure a battery.

No results match your search.

Reading battery data

There's no live-pushed array here like telemetry, and no always-current root property either: you explicitly request the data with signalBatteryList() (see Signals below for the rest of this group), and the response lands directly in a ListModel plus a small set of companion properties, all populated together before your very next line of code runs. This is exactly how the built-in Battery Manager screens themselves read it β€” qml/Model/BatMan/BatteryView.qml, qml/Model/BatMan/BatUsageView.qml, qml/Item/Widget/WidgetModelBat.qml.

Request, then read β€” no signal to wait on

Unlike signalTelemXxx (see Status & Telemetry), there's no separate "data changed" signal to connect to. Call signalBatteryList() and read battery_list / battery_current right on the next line β€” every built-in screen that uses this does exactly that, relying on the call resolving before it goes on to read the result. Nothing refreshes this data for you in the background, though: call signalBatteryList() again whenever you want it current β€” once when your app opens is enough for a one-off read, but if you want it to stay live while shown, poll it on a repeating Timer too, the way WidgetModelBat.qml re-requests every 10 seconds and BatteryView.qml every 1 second while open.

The whole pattern β€” showing the selected battery's name and cycle count, close to how WidgetModelBat.qml does it:

Item {
	Component.onCompleted: signalBatteryList ()

	Label {
		text: battery_list.count
			? battery_current + " - " + battery_list.get (battery_current_id).counter + " cycles"
			: "No batteries configured"
	}
}
battery_list ListModel

Every battery profile configured for the current model, refreshed each time you call signalBatteryList(). Read one profile with battery_list.get(index) β€” each row has:

FieldTypeMeaning
namestringProfile name, as shown in the Battery Manager menu.
typeint0 = User (capacity/voltage entered by hand); 1–16 = LiPo cell count β€” the same values signalBatteryAdd(name, type, voltage, capacity) accepts.
voltageintNominal voltage, Volts × 10 β€” divide by 10 before displaying.
capacityintRated capacity in mAh.
counterintCycle count β€” how many times this battery has been used/counted as flown.
flight_timeintAccumulated flight time in seconds. The built-in Usage view formats it as minutes:seconds with parseInt(flight_time / 60) + ":" + pad(flight_time % 60).
sharedboolTrue if this profile is also shared with other models (signalBatteryShare) rather than private to the current one.
battery_current string battery_current_id int

The currently-selected battery's name and its row index into battery_list, kept together β€” look up its full profile with battery_list.get(battery_current_id), exactly as the cycle-count example above does. Changed by the pilot from the Battery Manager menu, or by your own app calling signalBatterySel(name). If nothing has been selected yet and at least one battery is configured, the first response after signalBatteryList() auto-selects battery_list.get(0) for you.

batman_sensor int batman_ctr_type int batman_ctr_lim int

The current model's Battery Manager hardware-tracking configuration β€” saved with signalBatmanSave(sensor, type, limit), read back alongside the battery list itself. batman_sensor is 0 for manual mode β€” the pilot picks the active battery themselves, and the built-in UI prompts a selection screen at power-on whenever more than one battery is configured β€” or a specific telemetry sensor index once set up for automatic tracking instead. batman_ctr_type/batman_ctr_lim configure the condition and capacity-percentage threshold that count a cycle in automatic mode.

Signals

Per-model battery profiles, usage tracking, and sharing between models. signalBatteryList() is also covered above in Reading battery data, for what to do with the response.

signalBatteryList()

Loads/refreshes the battery profiles configured for the current model.

signalBatteryAdd(string name, int type, int voltage, int capacity)

Adds a new battery profile name with chemistry/type, nominal voltage, and capacity (mAh).

signalBatteryDel(string name, bool full)

Deletes battery profile name; full controls whether associated usage history is purged too.

signalBatteryRen(string oldn, string newn)

Renames battery profile oldn to newn.

signalBatterySet(string name, int voltage, int capacity)

Updates voltage/capacity for battery profile name.

signalBatteryReset(string name)

Resets accumulated usage stats for battery name.

signalBatterySel(string name)

Selects battery name as the currently-used battery for the model.

signalBatteryShare(string model, string batname, bool rem)

Shares battery profile batname with another model (or un-shares it, if rem is true).

signalBatteryShareList(int type)

Lists batteries of type available for sharing.

signalBatmanSave(int sensor, int type, int limit)

Saves Battery Manager hardware-sensor configuration: telemetry sensor, counter type, and threshold limit.

signalBatmanSort(string name, int index)

Reorders Battery Manager entry name to position index.