more cleaning, adding GPS data to service control site

This commit is contained in:
2025-07-28 10:10:51 -07:00
parent c36e56f234
commit 463c5a4784
7 changed files with 69 additions and 33 deletions

View File

@ -1,11 +1,15 @@
This playbook will prep a computer to be a road trip car computer
This playbook preps a computer to be a road trip car computer
It will capture snapshots from an attached camera, and it will display the feed on the screen
It capture snapshots from an attached camera to local storage, and it displays the feed on the screen
It will also host a site for the remote end that searches a working directory for the newest file and displays it and it does so every second
It also hosts a site for the remote end that searches a working directory for the newest file and displays it and it does so every second
It will also have a site to press a button to start and stop the timelapse
It also has a site to press a button to start and stop the timelapse service
A lot of this doesn't exist yet or needs to be tested
It was designed to run on the GOLE Handheld from Amazon
I want to write most of it first and then push it out to test
https://www.amazon.com/HIGOLEPC-PC-PRO-Computer-Ethernet/dp/B0BCVXLD5W
Also, a USB GPS dongle is $15
https://www.amazon.com/dp/B07GJGSZB9

View File

@ -39,13 +39,13 @@ kiosk_service_templates:
user_data_dir: "/opt/chrome/one"
extra_chrome_configs: |
--user-data-dir=/opt/chrome/one \
- chrome_resolution: "720,550"
- chrome_resolution: "720,600"
chrome_website: "http://127.0.0.1:8081"
service_name: chrome_timelapse_control
extra_service_configs: ""
user_data_dir: "/opt/chrome/two"
extra_chrome_configs: |
--window-position="0,410" \
--window-position="0,450" \
--user-data-dir="/opt/chrome/two" \
create_data_dir: true

View File

@ -14,30 +14,30 @@
### Bottom Service Control Panel
- name: Install Packages
apt:
name: "{{ item }}"
state: present
loop: "{{ main_packages }}"
- name: Install ustreamer
include_tasks: ustreamer.yaml
- name: Install gps_service
include_tasks: gps_service.yaml
- name: install timelapse service
include_tasks: timelapse.yaml
- name: Install photo refresh site
include_tasks: photo_refresh.yaml
- name: Install timelapse service control
include_tasks: service_control.yaml
- name: Install cosmos autologin user
include_tasks: cosmos_autologin.yaml
#- name: Install Packages
# apt:
# name: "{{ item }}"
# state: present
# loop: "{{ main_packages }}"
#
#- name: Install ustreamer
# include_tasks: ustreamer.yaml
#
#- name: Install gps_service
# include_tasks: gps_service.yaml
#
#- name: install timelapse service
# include_tasks: timelapse.yaml
#
#- name: Install photo refresh site
# include_tasks: photo_refresh.yaml
#
#- name: Install timelapse service control
# include_tasks: service_control.yaml
#
#- name: Install cosmos autologin user
# include_tasks: cosmos_autologin.yaml
#
- name: Set up Chrome Kiosk Services
include_tasks: chrome.yaml

View File

@ -104,6 +104,12 @@
owner: root
group: root
- name: service_control_website - template index.php
template:
src: index-service_control.php.j2
dest: "{{ service_control_web_folder }}/html/index.php"
mode: 0644
###############################################
# Start photo_refresh
###############################################

View File

@ -52,6 +52,30 @@ function runAPI($submitted_status) {
return isset($data['Status']) ? $data['Status'] : 'unknown';
}
function getGPS(){
if (!file_exists("{{ gps_service_directory }}/gps_data")) {
return "No GPS data available.";
}
try {
$LAT = shell_exec("cat {{ gps_service_directory }}/gps_data | grep lat | cut -d ':' -f 2 | awk '{printf(\"%.5f\n\", $1)}')");
$LON = shell_exec("cat {{ gps_service_directory }}/gps_data | grep lon | cut -d ':' -f 2 | awk '{printf(\"%.5f\n\", $1)}')");
$SPEED = floatval(trim(shell_exec("cat {{ gps_service_directory }}/gps_data | grep speed | cut -d ':' -f 2)"))) * 0.62;
} catch (Exception $e) {
return "Failed to parse gps_data: ".$e;
}
if (is_null($LAT)) {
return "No GPS data available.";
}
if (is_null($LON)) {
return "No GPS data available.";
}
return $LAT.", ".$LON.", ".$SPEED."mph";
}
// Check if the button was clicked via AJAX request
// if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// $button_recent = true;
@ -166,7 +190,9 @@ if($button_recent){
<div class="api-data">
<!-- PHP will inject the data here -->
<?php
echo "Full Message:<br>".htmlspecialchars($message)."<p>Current Date:<br>".date("F j, Y, g:i:s a")."<p>";
echo "Full Message:<br>".htmlspecialchars($message)."<p>";
echo "Current Date:<br>".date("F j, Y, g:i:s a")."<p>";
echo "Current GPS Data:<br>".getGPS();
?>
</div>