Skip to content

Commit

Permalink
Merge pull request #135 from SpaceTeam/CI-artifacts
Browse files Browse the repository at this point in the history
Add config and systemd service file to github artifacts
  • Loading branch information
florg-32 authored Jan 7, 2024
2 parents a54f95c + 74fa339 commit 6aa4a91
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ jobs:
- name: Prepare
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build
run: cross build --release --target aarch64-unknown-linux-gnu
run: |
cross build --release --target aarch64-unknown-linux-gnu
mv target/aarch64-unknown-linux-gnu/release/STS1_EDU_Scheduler .
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: aarch64 binary
path: target/aarch64-unknown-linux-gnu/release/STS1_EDU_Scheduler
name: aarch64 package
path: |
STS1_EDU_Scheduler
config.toml
scheduler.service
4 changes: 3 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

This software is the main executable run on the EDU. Its task is to receive commands from the COBC and execute them accordingly.

## Architecture
## Installing

Under githubs action page you can always find the binary crosscompiled for the raspi. Extract the provided archive into `/opt/scheduler` and simply execute `./STS1_EDU_Scheduler` manually, or symlink (`ln -s /opt/scheduler/scheduler.service /etc/systemd/system/scheduler.service`) the service file and enable it (`systemctl daemon-reload && systemctl enable scheduler`) to autostart.

## Further information

Expand Down
10 changes: 10 additions & 0 deletions scheduler.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=STS1 EDU Scheduler

[Service]
Type=simple
WorkingDirectory=/opt/scheduler
ExecStart=/opt/scheduler/STS1_EDU_Scheduler

[Install]
WantedBy=multi-user.target
5 changes: 2 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ struct Configuration {
heartbeat_pin: u8,
update_pin: u8,
heartbeat_freq: u64,
log_path: String,
}

fn main() -> ! {
let config: Configuration =
toml::from_str(&std::fs::read_to_string("./config.toml").unwrap()).unwrap();
toml::from_str(&std::fs::read_to_string("./config.toml").expect("Could not open config file")).unwrap();

create_directory_if_not_exists("archives").unwrap();
create_directory_if_not_exists("data").unwrap();
Expand All @@ -36,7 +35,7 @@ fn main() -> ! {
log::info!("Scheduler started");

// construct a wrapper for UART communication
let mut com = serialport::new(&config.uart, config.baudrate).open().unwrap();
let mut com = serialport::new(&config.uart, config.baudrate).open().expect("Could not open serial port");
com.set_timeout(&Duration::from_secs(60));

// construct a wrapper for resources that are shared between different commands
Expand Down

0 comments on commit 6aa4a91

Please sign in to comment.