updating and housekeeping

This commit is contained in:
Max Känner 2024-01-22 21:20:49 +01:00
parent 33fdd0252f
commit 8e8b3cd305
6 changed files with 26 additions and 15 deletions

View File

@ -3,6 +3,7 @@ target = "armv5te-unknown-linux-musleabi"
[target.armv5te-unknown-linux-musleabi] [target.armv5te-unknown-linux-musleabi]
linker = "rust-lld" linker = "rust-lld"
runner = "./upload.sh"
[target.armv5te-unknown-linux-gnueabi] [target.armv5te-unknown-linux-gnueabi]
linker = "/usr/bin/arm-linux-gnueabi-gcc" linker = "/usr/bin/arm-linux-gnueabi-gcc"

19
Cargo.lock generated
View File

@ -179,9 +179,9 @@ dependencies = [
[[package]] [[package]]
name = "ev3dev-lang-rust" name = "ev3dev-lang-rust"
version = "0.12.1" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d275b47949d28dbb58753369e37b4fae3b0643db685a2673ae189ad3cf286862" checksum = "029332714b8e1658454779f5dba942de0f2d408e21f63cdc794b13792eca33ee"
dependencies = [ dependencies = [
"ev3dev-lang-rust-derive", "ev3dev-lang-rust-derive",
"framebuffer", "framebuffer",
@ -202,13 +202,13 @@ dependencies = [
[[package]] [[package]]
name = "ev3dev-pid-linefollow" name = "ev3dev-pid-linefollow"
version = "0.1.0" version = "1.0.0"
dependencies = [ dependencies = [
"ev3dev-lang-rust", "ev3dev-lang-rust",
"exec", "exec",
"image", "image",
"imageproc", "imageproc",
"itertools", "itertools 0.12.0",
"paste", "paste",
"pid", "pid",
"rand 0.8.5", "rand 0.8.5",
@ -367,7 +367,7 @@ dependencies = [
"approx", "approx",
"conv", "conv",
"image", "image",
"itertools", "itertools 0.10.5",
"nalgebra", "nalgebra",
"num", "num",
"rand 0.7.3", "rand 0.7.3",
@ -385,6 +385,15 @@ dependencies = [
"either", "either",
] ]
[[package]]
name = "itertools"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
dependencies = [
"either",
]
[[package]] [[package]]
name = "jpeg-decoder" name = "jpeg-decoder"
version = "0.3.0" version = "0.3.0"

View File

@ -1,10 +1,10 @@
[package] [package]
name = "ev3dev-pid-linefollow" name = "ev3dev-pid-linefollow"
version = "0.1.0" version = "1.0.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
ev3dev-lang-rust = { version = "0.12.0", features = ["screen"] } ev3dev-lang-rust = { version = "0.13.0", features = ["screen"] }
image = "0.24" image = "0.24"
imageproc = "0.23" imageproc = "0.23"
rusttype = "0.9" rusttype = "0.9"
@ -12,9 +12,11 @@ paste = "1.0"
pid = "4.0" pid = "4.0"
thiserror = "1.0" thiserror = "1.0"
rand = "0.8" rand = "0.8"
itertools = "0.10" itertools = "0.12"
exec = "0.3" exec = "0.3"
[profile.release] [profile.release]
opt-level = "z"
lto = true lto = true
codegen-units = 1
strip = "debuginfo" strip = "debuginfo"

View File

@ -1,4 +1,4 @@
use ev3dev_lang_rust::Ev3Button; use ev3dev_lang_rust::Button;
use ev3dev_lang_rust::Ev3Result; use ev3dev_lang_rust::Ev3Result;
use paste::paste; use paste::paste;
@ -7,7 +7,7 @@ macro_rules! button_impl {
paste! { paste! {
pub struct SmartEv3Buttons { pub struct SmartEv3Buttons {
buttons: Ev3Button, buttons: Button,
$( $(
[<last_ $name>]: bool, [<last_ $name>]: bool,
)* )*
@ -15,7 +15,7 @@ macro_rules! button_impl {
impl SmartEv3Buttons { impl SmartEv3Buttons {
pub fn new() -> Ev3Result<Self> { pub fn new() -> Ev3Result<Self> {
let buttons = Ev3Button::new()?; let buttons = Button::new()?;
buttons.process(); buttons.process();
$( $(
let [<last_ $name>] = buttons.[<is_ $name>](); let [<last_ $name>] = buttons.[<is_ $name>]();

View File

@ -11,7 +11,6 @@ use ev3dev_lang_rust::{
use exec::execvp; use exec::execvp;
use itertools::Itertools; use itertools::Itertools;
use pid::Pid; use pid::Pid;
use rand::{thread_rng, Rng};
use rusttype::Font; use rusttype::Font;
use std::{ use std::{
env, env,
@ -51,8 +50,8 @@ fn try_main() -> Result<(), Box<dyn Error>> {
})?; })?;
let mut buttons = SmartEv3Buttons::new()?; let mut buttons = SmartEv3Buttons::new()?;
left_motor.set_polarity(LargeMotor::POLARITY_INVERSED)?; left_motor.set_polarity(LargeMotor::POLARITY_NORMAL)?;
right_motor.set_polarity(LargeMotor::POLARITY_INVERSED)?; right_motor.set_polarity(LargeMotor::POLARITY_NORMAL)?;
left_motor.set_stop_action(LargeMotor::STOP_ACTION_BRAKE)?; left_motor.set_stop_action(LargeMotor::STOP_ACTION_BRAKE)?;
right_motor.set_stop_action(LargeMotor::STOP_ACTION_BRAKE)?; right_motor.set_stop_action(LargeMotor::STOP_ACTION_BRAKE)?;

View File

@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
cargo build --release && scp target/armv5te-unknown-linux-musleabi/release/ev3dev-pid-linefollow robot@ev3dev:/home/robot/ scp "$1" robot@ev3dev:/home/robot/