Compare commits
7 Commits
realtime
...
fc74dc5d9b
| Author | SHA1 | Date | |
|---|---|---|---|
| fc74dc5d9b | |||
| edaac93dfd | |||
| 1b2862dea5 | |||
| 6b70140869 | |||
| 23b1863a82 | |||
| b7894ea559 | |||
| f84022b8cf |
@@ -1,3 +1,4 @@
|
||||
/target
|
||||
/.vscode
|
||||
/libs
|
||||
Cargo.lock
|
||||
|
||||
+8
-2
@@ -26,12 +26,18 @@ opt-level = 1
|
||||
[profile.release]
|
||||
opt-level = 3
|
||||
|
||||
[package.metadata.appimage]
|
||||
assets = ["resources"]
|
||||
icon = "resources/icon.png"
|
||||
desktop_entry = "other/rs-dublinbus.desktop"
|
||||
auto-link=true
|
||||
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
cc = "aarch64-linux-gnu-gcc"
|
||||
cxx = "aarch64-linux-gnu-g++"
|
||||
ar = "aarch64-linux-gnu-ar"
|
||||
# ranlib = "aarch64-linux-gnu-ranlib"
|
||||
linker = "aarch64-linux-gnu-gcc"
|
||||
ranlib = "aarch64-linux-gnu-ranlib"
|
||||
linker = "aarch64-linux-gnu-ld"
|
||||
|
||||
|
||||
[target.arm-unknown-linux-gnueabihf]
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
# The deployment process works like this:
|
||||
# 1. Build locally just to make sure that things work
|
||||
# 2. SSH into the machine that will build the AppImage for ARM. There:
|
||||
# 2.1. run git pull to get the latest version of the code
|
||||
# 2.2. run argo appimage to build the image
|
||||
# 3. SCP the appimage back to the local machine
|
||||
# 4. SCP the files to the Raspberry Pi running the display:
|
||||
# AppImage
|
||||
# systemd service file
|
||||
# 5. SSH into the display machine as root and:
|
||||
# 5.1. Copy the AppImage file to /opt/dublinbus-display (create the directory if necessary)
|
||||
# 5.2. If the service exists, restart it and exit
|
||||
# 5.3. Copy the service file to /etc/systemd/system
|
||||
# 5.4. Enable and activate the service
|
||||
|
||||
|
||||
|
||||
# Variables
|
||||
GIT_REPO_URL="http://git.nahuellofeudo.com/nahuel/rs-dublinbus.git"
|
||||
|
||||
# For the build machine
|
||||
BUILD_MACHINE_NAME=raspi-ssd.localnet
|
||||
BUILD_MACHINE_USER=nahuel
|
||||
BUILD_MACHINE_SOURCE_DIRECTORY=/home/nahuel/Documents/sources
|
||||
|
||||
|
||||
# 1. Build locally
|
||||
cargo appimage
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo
|
||||
echo
|
||||
echo "-------------------------------------------------------"
|
||||
echo "\"cargo appimage\" failed. Check the logs"
|
||||
echo "-------------------------------------------------------"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "-------------------------------------------------------"
|
||||
echo "Local build successful "
|
||||
echo "-------------------------------------------------------"
|
||||
|
||||
# 2. Build remotely on the ARM machine
|
||||
ssh $BUILD_MACHINE_USER@$BUILD_MACHINE_NAME << EOF
|
||||
echo Entering ${BUILD_MACHINE_SOURCE_DIRECTORY}
|
||||
cd ${BUILD_MACHINE_SOURCE_DIRECTORY}
|
||||
if [[ ! -n rs-dublinbus ]]; then
|
||||
git clone ${GIT_REPO_URL}
|
||||
cd rs-dublinbus
|
||||
else
|
||||
cd rs-dublinbus
|
||||
git pull
|
||||
fi
|
||||
|
||||
cargo clean
|
||||
cargo appimage
|
||||
EOF
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo
|
||||
echo
|
||||
echo "-------------------------------------------------------"
|
||||
echo "Remote build failed. Check the logs"
|
||||
echo "-------------------------------------------------------"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "-------------------------------------------------------"
|
||||
echo "Remote build successful "
|
||||
echo "-------------------------------------------------------"
|
||||
@@ -3,6 +3,17 @@
|
||||
- LCD Rounded font by Jecko Development (http://www.jeckodevelopment.com)
|
||||
|
||||
|
||||
## Dependencies (Debian/Raspberry Pi OS)
|
||||
|
||||
* librust-openssl-dev
|
||||
* protobuf-compiler
|
||||
* libsdl3-dev
|
||||
* libsdl3-ttf-dev
|
||||
|
||||
## Install appimage package
|
||||
```
|
||||
cargo install cargo-appimage
|
||||
```
|
||||
|
||||
## Install ARM toolchains:
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Start Dublin Bus display
|
||||
After=multi-user.target
|
||||
Wants=multi-user.target
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
Type=exec
|
||||
ExecStart=/opt/dublinbus/rs-dublinbus.AppImage
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -14,5 +14,5 @@ gtfs:
|
||||
data-folder: "/home/nahuel/Downloads"
|
||||
gtfs-url: "https://www.transportforireland.ie/transitData/Data/GTFS_Realtime.zip"
|
||||
realtime-url: "https://api.nationaltransport.ie/gtfsr/v2/gtfsr"
|
||||
realtime-api-key: "Not defined"
|
||||
realtime-api-key: "aa8509902455412e886b9df11f0e21ec"
|
||||
refresh-seconds: 61
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
@@ -1,14 +0,0 @@
|
||||
JECKO DEVELOPMENT FONT
|
||||
|
||||
This font was created by Jecko Development (http://www.jeckodevelopment.com)
|
||||
This font has a homepage where this archive and other versions may be found ::
|
||||
http://www.jeckodevelopment.com/fonts/
|
||||
This font is released under a Creative Commons Attribution Non-commercial No Derivatives
|
||||
license (http://creativecommons.org/licenses/by-nc-nd/3.0/).
|
||||
NOTE FOR FLASH USERS: This font is optimized for
|
||||
Flash. If the font in this archive is a pixel font, it is best displayed at a
|
||||
font-size of 64.
|
||||
|
||||
Feel free to write us at info@jeckodevelopment.com or visit our website http://www.jeckodevelopment.com
|
||||
|
||||
|
||||
+13
-5
@@ -1,10 +1,10 @@
|
||||
mod gtfs;
|
||||
mod renderer;
|
||||
mod config;
|
||||
use std::{ops::Add, process, thread::Builder, time::SystemTime};
|
||||
use std::{env, ops::Add, process, thread::Builder, time::SystemTime};
|
||||
use chrono::{DateTime, Duration, Local, NaiveTime};
|
||||
use log::{Level, Metadata, Record, error, info};
|
||||
use sdl3::event::Event;
|
||||
use log::{Metadata, Record, error, info};
|
||||
use sdl3::{event::Event};
|
||||
use crate::{config::load_config, gtfs::structs::{Arrival, Gtfs}, renderer::structs::{DisplayData, DisplayEntry, Screen}};
|
||||
|
||||
const NUM_ARRIVALS: usize = 4;
|
||||
@@ -54,12 +54,15 @@ fn refresh_schedule<'a>(gtfs: &'a Gtfs, screen : &mut Screen<'a>) -> Option<Vec<
|
||||
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
||||
// Initialize logger
|
||||
static MY_LOGGER: MyLogger = MyLogger;
|
||||
|
||||
struct MyLogger;
|
||||
impl log::Log for MyLogger {
|
||||
fn enabled(&self, metadata: &Metadata) -> bool {
|
||||
return metadata.level() < Level::Trace;
|
||||
fn enabled(&self, _metadata: &Metadata) -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
fn log(&self, record: &Record) {
|
||||
@@ -76,7 +79,12 @@ fn main() {
|
||||
print!("Error setting up the main logger:{:#?}", logger.err());
|
||||
process::exit(-1);
|
||||
}
|
||||
|
||||
if args.contains(&String::from("--debug")) {
|
||||
log::set_max_level(log::LevelFilter::Trace);
|
||||
} else {
|
||||
log::set_max_level(log::LevelFilter::Warn);
|
||||
}
|
||||
|
||||
|
||||
let config_result = load_config(String::from("resources/dublinbus.yaml"));
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ const TEXT_SIZE: f32 = 160.0; // Size of the font in pixels
|
||||
// Offsets of each part within a line
|
||||
const XOFFSET_ROUTE: u32 = 24;
|
||||
const XOFFSET_DESTINATION: u32 = 300;
|
||||
const XOFFSEET_TIME_LEFT: u32 = 1606;
|
||||
const XOFFSEET_TIME_LEFT: u32 = 1560;
|
||||
const INTER_LINE_OVERLAP: u32 = 15;
|
||||
|
||||
impl Screen<'_> {
|
||||
|
||||
Reference in New Issue
Block a user