feat(#34): adds support for header 'battery-percent'

This commit is contained in:
Benjamin Nussbaum 2025-06-16 14:40:01 +02:00
parent 42c25fc403
commit af934ffdc2
2 changed files with 33 additions and 0 deletions

View file

@ -48,6 +48,14 @@ Route::get('/display', function (Request $request) {
'last_refreshed_at' => now(),
]);
if ($request->hasHeader('battery-percent')) {
$batteryPercent = (int) $request->header('battery-percent');
$batteryVoltage = $device->calculateVoltageFromPercent($batteryPercent);
$device->update([
'last_battery_voltage' => $batteryVoltage,
]);
}
// Get current screen image from a mirror device or continue if not available
if (! $image_uuid = $device->mirrorDevice?->current_screen_image) {
$refreshTimeOverride = null;