Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0e7ad61
Update robot_status.launch to use esp-daemon device; add ESP-Daemon d…
SeanChangX Apr 7, 2025
db22fa7
Refactor .env files for robot_status_bridge and foxglove-bridge
SeanChangX Apr 7, 2025
11b1351
Update voltmeter calibration values in config.h for accuracy
SeanChangX Apr 7, 2025
ff573c0
Update ESP-NOW configuration and WiFi channel handling
SeanChangX Apr 7, 2025
c4d1442
Add udev rule for esp-daemon device
SeanChangX Apr 7, 2025
22f1f8d
Update ESP device check in status commands to reflect new device path
SeanChangX Apr 9, 2025
00cfa8e
Update battery watchdog script to handle missing esp32-daemon device …
SeanChangX Apr 9, 2025
d36ab46
Update config.h for dynamic robot ID and update relay control logic
SeanChangX Apr 9, 2025
65e1e3e
Update conky_entry.sh to open Web UI
SeanChangX Apr 9, 2025
b6995bd
Update conky_entry.sh to launch Robot UI in kiosk mode and restore Fi…
SeanChangX Apr 9, 2025
ca05e69
Fix formatting in conky_entry.sh to properly launch Robot UI in kiosk…
SeanChangX Apr 9, 2025
2b19abc
Refactor config.h to remove dynamic ROBOT_ID and set static values fo…
SeanChangX Apr 9, 2025
3eeaeb2
Update esp-daemon symlink in 80-dit.rules to correct serial number
SeanChangX Apr 11, 2025
6310512
Refactor LED control logic and enhance ESP-NOW communication handling
SeanChangX Apr 11, 2025
61d2f89
Refactor LED control parameters and update main task delay handling
SeanChangX Apr 11, 2025
c36b315
Refactor WiFi connection logic to include retry mechanism and configu…
SeanChangX Apr 11, 2025
8d2cc96
Fix ESP32 connection handling and improve battery status monitoring l…
SeanChangX Apr 12, 2025
0267dd1
Fix Firefox command syntax for ESP32 reconnection handling
SeanChangX Apr 12, 2025
866e752
Fix Firefox command to open in a new window for kiosk mode
SeanChangX Apr 12, 2025
a6a018b
Refactor low battery warning logic to include duration check before b…
SeanChangX Apr 14, 2025
3a6b236
Reorder include statements for consistency across multiple files
SeanChangX Apr 16, 2025
42328cc
Merge branch 'feature/esp-daemon' into dev
SeanChangX Apr 16, 2025
d5ec899
Refactor script commands to use main executable instead of Docker for…
SeanChangX Apr 16, 2025
b5aceb9
Refactor ESP-NOW communication to support multiple broadcast addresse…
SeanChangX Apr 22, 2025
7a932cf
Update udev rules for chassis and mission devices to correct serial n…
SeanChangX Apr 23, 2025
a132da2
Add modern floating button with short and long press functionality
SeanChangX Apr 23, 2025
6fb096b
Merge branch 'dev' into feature/esp-daemon
SeanChangX Apr 23, 2025
86b0f5c
Merge branch 'feature/esp-daemon' into dev
SeanChangX Apr 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,31 @@ DISCONNECTED_THRESHOLD=0.0
LOW_BATTERY_SOUND="warning_low_battery_en_1.mp3"
DISCONNECTED_SOUND="battery_removed.mp3"
DISCONNECTED_PLAYED=false
ESP32_RECONNECTED=true
LOW_BATTERY_DURATION=30
low_battery_start_time=0

while true; do
if [ ! -L "/dev/esp-daemon" ] || [ ! -e "/dev/esp-daemon" ]; then
ESP32_RECONNECTED=false
if [ -f "$BATTERY_STATUS_FILE" ]; then
last_modified=$(stat -c %Y "$BATTERY_STATUS_FILE")
current_time=$(date +%s)
current_content=$(cat "$BATTERY_STATUS_FILE")
if (( current_time - last_modified > 3 )) && [ "$current_content" != '{"voltage": 0}' ]; then
echo -n '{"voltage": 0}' > "$BATTERY_STATUS_FILE"
fi
else
echo -n '{"voltage": 0}' > "$BATTERY_STATUS_FILE"
fi
else
if [[ "$ESP32_RECONNECTED" == false ]]; then
pkill -f "firefox --new-window -P default --kiosk http://${HOSTNAME}-esp.local"
(sleep 5 && firefox --new-window -P "default" --kiosk "http://${HOSTNAME}-esp.local" &)
ESP32_RECONNECTED=true
fi
fi

if [ -f "$BATTERY_STATUS_FILE" ]; then
voltage=$(jq -r '.voltage' "$BATTERY_STATUS_FILE")

Expand All @@ -26,10 +49,18 @@ while true; do
DISCONNECTED_PLAYED=false

if (( $(echo "$voltage < $LOW_BATTERY_THRESHOLD" | bc -l) )); then
if ! pgrep -x "ffplay" > /dev/null; then
# Broadcast low battery warning
ffplay -nodisp -autoexit "$LOW_BATTERY_SOUND" > /dev/null 2>&1 &
if [ $low_battery_start_time -eq 0 ]; then
low_battery_start_time=$(date +%s)
fi
current_time=$(date +%s)
if (( current_time - low_battery_start_time >= LOW_BATTERY_DURATION )); then
if ! pgrep -x "ffplay" > /dev/null; then
# Broadcast low battery warning
ffplay -nodisp -autoexit "$LOW_BATTERY_SOUND" > /dev/null 2>&1 &
fi
fi
else
low_battery_start_time=0
fi
fi
fi
Expand Down
20 changes: 13 additions & 7 deletions .config/conky/conky_entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ $DIR/conky-esp-config/10-network_watchdog/network_watchdog.sh &

# # Run the Web Pannel essential scripts
# /home/ditrobotics/DIT-Scripts/web-ui/scripts/aio.sh &
# # Wait for the web server to start
# while ! nc -z localhost 5000; do
# sleep 0.1
# done
#
# # Open Robot UI in Firefox
# firefox http://localhost:5000 http://${HOSTNAME}-esp.local &

# Wait for the web server to start
while ! nc -z localhost 8080; do
sleep 1
done

# Open Robot UI
chromium --kiosk \
"http://localhost:8080/?ds=foxglove-websocket&ds.url=ws://$(hostname -I | cut -d" " -f1):8765" \
&
firefox --new-window -P "default" --kiosk \
"http://${HOSTNAME}-esp.local" \
&
Binary file added .config/firefox/firefox_profile_backup.tar.gz
Binary file not shown.
1 change: 0 additions & 1 deletion .mozilla/firefox/dit_config.default/handlers.json

This file was deleted.

163 changes: 0 additions & 163 deletions .mozilla/firefox/dit_config.default/prefs.js

This file was deleted.

18 changes: 13 additions & 5 deletions 15-user_preference.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

DIT_HOME="/home/ditrobotics"

# Check if the current user is root
if [ "$(id -u)" != "0" ]; then
echo -e "This script must be run as root. \nPlease run again with 'sudo $0'"
Expand All @@ -11,30 +13,36 @@ restore_firefox() {
echo -e "\033[32mRestoring firefox user preference...\033[0m"
# You need to open firefox first to create the folder
read -p "Please open firefox first. Press [Enter] key to continue..."
find /home/ditrobotics/snap/firefox/common/.mozilla/firefox/ -type d -name "*.default" -exec cp -r /home/ditrobotics/DIT-Scripts/.mozilla/firefox/dit_config.default/* {} \;
if [ -d "$DIT_HOME/snap/firefox/common/.mozilla/firefox/" ]; then
rm -rf "$DIT_HOME/snap/firefox/common/.mozilla/firefox/"
fi
mkdir -p "$DIT_HOME/snap/firefox/common/.mozilla/firefox/"
tar -xzf "$DIT_HOME/DIT-Scripts/.config/firefox/firefox_profile_backup.tar.gz" -C "$DIT_HOME/snap/firefox/common/.mozilla/firefox/"
chown -R ditrobotics:ditrobotics "$DIT_HOME/snap/firefox/common/.mozilla/firefox/"
chmod -R 700 "$DIT_HOME/snap/firefox/common/.mozilla/firefox/"
}

# Restore desktop configuration
restore_desktop() {
echo -e "\033[32mRestoring desktop user preference...\033[0m"

cp -r /home/ditrobotics/DIT-Scripts/desktop/* /home/ditrobotics/Desktop/
cp -r "$DIT_HOME/DIT-Scripts/desktop/"* "$DIT_HOME/Desktop/"

if [ ! -d /home/share/scripts/ ]; then
mkdir -p /home/share/scripts/
fi
cp -r /home/ditrobotics/DIT-Scripts/share/scripts/* /home/share/scripts/
cp -r "$DIT_HOME/DIT-Scripts/share/scripts/"* /home/share/scripts/

if [ ! -d /home/share/data/ ]; then
mkdir -p /home/share/data/
fi
cp -r /home/ditrobotics/DIT-Scripts/share/data/* /home/share/data/
cp -r "$DIT_HOME/DIT-Scripts/share/data/"* /home/share/data/
}

# Restore plymouth theme configuration
restore_plymouth() {
echo -e "\033[32mRestoring plymouth theme preference...\033[0m"
cp -r /home/ditrobotics/DIT-Scripts/system/plymouth-themes/abstract_ring_alt /usr/share/plymouth/themes/
cp -r "$DIT_HOME/DIT-Scripts/system/plymouth-themes/abstract_ring_alt" /usr/share/plymouth/themes/
update-alternatives --install /usr/share/plymouth/themes/default.plymouth default.plymouth /usr/share/plymouth/themes/abstract_ring_alt/abstract_ring_alt.plymouth 100
echo -e "\033[32mSelect the number for installed theme...\033[0m"
update-alternatives --config default.plymouth
Expand Down
17 changes: 17 additions & 0 deletions app/esp_daemon/arduino/ESP_Daemon/data/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ <h1>ROBOT STATUS PANEL</h1>
</div>
</div>
</div>
<div class="floating-buttons">
<div class="modern-floating-btn" id="actionButton">
<div class="btn-icon">
<svg viewBox="0 0 24 24" width="24" height="24" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4M10 17l5-5-5-5M13 12H3"></path>
</svg>
</div>
<div class="btn-loading">
<svg viewBox="0 0 24 24" width="24" height="24">
<circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="4" stroke-dasharray="31.4 31.4">
<animateTransform attributeName="transform" type="rotate" from="0 12 12" to="360 12 12" dur="1s" repeatCount="indefinite"/>
</circle>
</svg>
</div>
<span class="btn-tooltip">Control Panel</span>
</div>
</div>
<div class="footer">
© 2025 Developed by <a href="https://github.com/SeanChangX" target="_blank">SeanChangX</a>
</div>
Expand Down
Loading