mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-13 15:07:49 +00:00
feat(#34): adds support for header 'battery-percent'
This commit is contained in:
parent
42c25fc403
commit
af934ffdc2
2 changed files with 33 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue