Skip to content

About

Systemd service for controlling a Korad lab powersupply

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pixie Controller

✨ Control your korad power supply through a taskbar widget ✨

About the Project

Computer controls for a ka3005d power supply, with a systemd background service to keep the serial connection alive. It listens to IPC calls for commands from the pixie-cli.

My power supply is sitting slightly too far away from my lazy ass. Instead of getting up I made a widget for in my i3status-rs bar to toggle the output. While I was writing this project I realized having a separate service also opens up the possibility for some cool embedded integration-tests.

Caution

This repo contains the worst rust code you will ever read, I cobbled this together in one evening, but will def improve on it.

i3status-rs config snippet

[[block]]
block = "custom"
command = "~/.local/bin/pixie-cli status"
interval = 1
[[block.click]]
button = "left"
cmd = "~/.local/bin/pixie-cli toggle"

The bar only refreshes every 1 sec, and I haven't found a way to make it faster :(

Toolchain

prek, just, cargo (duhh), text-editor, keyboard, 0.5L mate, monitor (I use a 12 inch 4:3, but you could go smaller), lungs (gotta keep breathing)

Installation

Currently there is no installer script or anything like that, so here I'll list the manual steps to get it up and running.

Files in the right place.

# this will copy the binaries into your ~/.local/bin.
just install
# create a local ~/.local/share/systemd/user/ and copy the service into it.
just service

Systemd commands.

# enable the service
systemctl --user enable pixie-controller
# start it
systemctl --user start pixie-controller


# check status
systemctl --user status pixie-controller
# tail the logs
journalctl --user -u pixie-controller -f

TODO

  • Build system for multiple bins
  • Rename bins to: pixie-controller, pixie-cli.
  • Send IPC commands to server.
  • Remove ambiguity around the type of socket we're using, enfore the UNIX specific one.
  • Support output status
  • Handle the interpretation of the output from the psu (the emoji for example) on the cli side.
  • Wrap default commands?
  • pixie-cli error when pixie-controller is not online.
  • Keep listening for new connection when PSU power cycles.
  • Improve logging especially in the pixie-controller.
  • in pixie-cli print to stdout.
  • Improve code A LOT and release to AUR.
  • Config file?

pixie-cli

This will take in the exact same commands as the ka3005p crate. But instead of calling the serial port we wrap that and call the pixie-controller through IPC.

pixie-controller

A daemon which listens for IPC, and runs the actual command through the serial port. Then passes the result back through IPC.

About

Systemd service for controlling a Korad lab powersupply

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages