Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async Refactor WIP #75

Merged
merged 58 commits into from
Oct 14, 2023
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
0e7f8e1
Refactor main: keep old semantic
horenso Aug 23, 2023
3e50b6f
Add scripts to emulate device.
horenso Aug 23, 2023
022fe0b
impl MOD-IR-TMP & Weatherstation
fel115 Aug 28, 2023
d9b14e5
exec - cagro fmt
fel115 Aug 29, 2023
9f38a18
WIP
horenso Aug 30, 2023
84c29a0
WIP: Async
horenso Aug 30, 2023
814a60a
More refactoring work: Split up functionality
horenso Aug 31, 2023
096c159
Update reqwest to 0.11
horenso Sep 1, 2023
04693c9
Refactor nextcloud module.
horenso Sep 1, 2023
5bddb7c
Changes in env_loop, weatherstation_loop, modir_loop, sensors_loop; i…
fel115 Sep 1, 2023
1aa694e
Merge branch 'refactor_main' of https://github.com/horenso/opensesame…
fel115 Sep 1, 2023
853e7c7
WIP move config out of loop
fel115 Sep 1, 2023
a1dbe33
More async refactoring.
horenso Sep 2, 2023
35207ad
compiling worked
fel115 Sep 4, 2023
dbf0dd5
Add join_all in main such that main waits for async modules.
horenso Sep 4, 2023
6c3edbd
ssh async; ErrorType
fel115 Sep 4, 2023
adca7d0
Buttons+Validator, Garage, Sensors, ModIR, Env, Nextcloud working
fel115 Sep 5, 2023
d913bb6
Merge branch 'refactor_main_update_async_loops' into refactor_main
fel115 Sep 5, 2023
a25a50e
Update gatage_loop after merge
fel115 Sep 5, 2023
6419f35
Add serde_json for json deserialization.
horenso Sep 6, 2023
dc6aae5
Add commands chat token to spec.
horenso Sep 6, 2023
238b2b4
Add beginning of chat commands; Move Nextcloud loops to nextcloud.rs
horenso Sep 6, 2023
77e5232
Rename OpensesameError to ModuleError.
horenso Sep 6, 2023
99dc4e9
Remove tokio-experiments and todo.
horenso Sep 10, 2023
bbc6c83
Implement first version of Nextcloud commands.
horenso Sep 10, 2023
cdebc5e
Move env, garage, sensor and bar loops into their files.
horenso Sep 10, 2023
a611ac4
Refactor get_background_task into modules and add lib.rs.
horenso Sep 10, 2023
e21b535
Make Weatherstation and watchdog async.
horenso Sep 11, 2023
8186192
Clippy auto fixes.
horenso Sep 11, 2023
d918a61
Make do_reset async.
horenso Sep 11, 2023
f29ac51
exec cargo fmt; change do_reset
fel115 Sep 12, 2023
9b61496
add LocalSet
fel115 Sep 12, 2023
5f76813
ideas of signals
fel115 Sep 12, 2023
c5a9333
created signals + ping; Added new command to buttons
fel115 Sep 13, 2023
0ffbcbd
Start refactor audio into own background task.
horenso Sep 13, 2023
48911d2
finished signals & cargo fmt
fel115 Sep 14, 2023
8637bf6
signals check for environment enabled
fel115 Sep 14, 2023
5fc9c9d
remove debug line form Sensors; add Testreport
fel115 Sep 14, 2023
b2958ad
Make button use audio sender to play audio file.
horenso Sep 15, 2023
7f46542
Merge branch 'audio' into refactor_main
horenso Sep 15, 2023
afcb03d
Add forgotten .await
horenso Sep 17, 2023
7941f0a
Implement Send for Config and Clima US. Use audio_sender in env.
horenso Sep 18, 2023
271868e
Use clippy suggestions.
horenso Sep 18, 2023
500257f
env implementation of mutex(remember/restore-baseline); sensor impl s…
fel115 Sep 18, 2023
711f147
exec cargo fmt
fel115 Sep 18, 2023
958a6b4
small changes
fel115 Sep 25, 2023
9cfd75a
Cancel previous audio signal when new Alarm/Bell signal comes in.
horenso Sep 27, 2023
c269875
Implementation of Issue #87
fel115 Sep 27, 2023
b8dc9bc
implementation of bat.rs + cargo fmt
fel115 Sep 27, 2023
e423420
changes in button.rs to handle do_reset; update bat.rs to only trigge…
fel115 Sep 27, 2023
77f004a
added test function for watchdog
fel115 Sep 27, 2023
9cec7d5
update specs; bat.rs reordering;
fel115 Sep 28, 2023
4a8d992
audio.rs logging to Ping Chat
fel115 Sep 29, 2023
4244064
rm state.set;
fel115 Oct 2, 2023
e4cac3c
some requested changes
fel115 Oct 3, 2023
4c7aed4
remove prints
fel115 Oct 12, 2023
6e7599a
changed requested changes
fel115 Oct 14, 2023
5619c48
Merge branch 'master' into refactor_main
fel115 Oct 14, 2023
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
Prev Previous commit
Next Next commit
added test function for watchdog
fel115 committed Sep 27, 2023
commit 77f004a51cf0a740dc8d4005cdf48ca1e87ba32a
19 changes: 19 additions & 0 deletions src/watchdog.rs
Original file line number Diff line number Diff line change
@@ -24,4 +24,23 @@ impl Watchdog {
.map_err(|_| ModuleError::new(String::from("could not write to watchdog")))?;
}
}

//This function is only used to test if the system reboots after this module stops writing to the watchdog file.
//For testing change the get_background_task to test_get_background_task in main.rs
pub async fn test_get_background_task(
path: String,
mut interval: Interval,
) -> Result<Never, ModuleError> {
let mut handle = File::create(path)
.await
.map_err(|_| ModuleError::new(String::from("could not open watchdog")))?;
for _i in 1..=100 {
interval.tick().await;
handle
.write_all(b"a")
.await
.map_err(|_| ModuleError::new(String::from("could not write to watchdog")))?;
}
Err(ModuleError::new(String::from("doesnt run for loop")))
}
}