You are browsing as a guest. Sign up (or log in) to start making projects!

2h 6m 50s logged

Let me first begin by saying, that this line:

    meters
        .fast_write(dash.cpu_load, dash.cpu_temp, dash.mem_used, dash.swap_used)
        .await
        .unwrap();
    hardware.ldac.set_high();

Kinda took me an hour to make, and 2 hours in ADHD sidetracking.
So, to get to this line, I had to remake the driver, not only because I was using computationally expensive floats, but because an u64 for an value between 0-4096 was wasteful of bytes.
While on it, I sidetracked and decided to redo the way the driver interfaced with the USB device, because it felt quite unprofessional to just bake in the serial port.
So, I wrote this fancy function that gets the serial port via the VID and PID, and it looks something like this:


    let keyboard_port = match utils::get_serial_with_vid_pid(DEVICE_VID, DEVICE_PID) {
        Ok(port_info) => port_info,
        Err(e) => {
            panic!("Error getting serial port! {}", e.description);
        }
    };
    let mut keyboard_cdc =
        match tokio_serial::new(keyboard_port.port_name, 115200).open_native_async() {
            Ok(port) => port,
            Err(e) => panic!("Error opening serial port! {}", e),
        };

As you can see, it’s now way more professional!
After that bit of sidetracking, I finally redid the types, and when I realized I would need an arduino style map functions, and that I was bored without internet, I rawdogged an library using the rustup documentation, not tracking the hours tho. You can get it via the crate “map-arduino”, and it works with all data types, I’m proud of myself!
Finally, after all that work, I had to do the MCP4728, and that line in the start took a loong time, mainly because theer were 500 different I2C types and I didnt understand anything, but, at last, it works ;D

0
13

Comments 1

@water

cool project twin!!! keep it going!