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]
linker = "rust-lld"
runner = "./upload.sh"
[target.armv5te-unknown-linux-gnueabi]
linker = "/usr/bin/arm-linux-gnueabi-gcc"

19
Cargo.lock generated
View File

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

View File

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

View File

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

View File

@ -11,7 +11,6 @@ use ev3dev_lang_rust::{
use exec::execvp;
use itertools::Itertools;
use pid::Pid;
use rand::{thread_rng, Rng};
use rusttype::Font;
use std::{
env,
@ -51,8 +50,8 @@ fn try_main() -> Result<(), Box<dyn Error>> {
})?;
let mut buttons = SmartEv3Buttons::new()?;
left_motor.set_polarity(LargeMotor::POLARITY_INVERSED)?;
right_motor.set_polarity(LargeMotor::POLARITY_INVERSED)?;
left_motor.set_polarity(LargeMotor::POLARITY_NORMAL)?;
right_motor.set_polarity(LargeMotor::POLARITY_NORMAL)?;
left_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
cargo build --release && scp target/armv5te-unknown-linux-musleabi/release/ev3dev-pid-linefollow robot@ev3dev:/home/robot/
scp "$1" robot@ev3dev:/home/robot/