forked from M-Labs/thermostat
Compare commits
7 Commits
44e9130010
...
9d89104f50
Author | SHA1 | Date | |
---|---|---|---|
9d89104f50 | |||
136c7a0b52 | |||
5000cae1b1 | |||
78ec77509f | |||
52aa3890c1 | |||
1ae6a6fdd4 | |||
7333d2cea5 |
@ -45,7 +45,7 @@ There are several options for flashing Thermostat. DFU requires only a micro-USB
|
|||||||
|
|
||||||
### dfu-util on Linux
|
### dfu-util on Linux
|
||||||
* Install the DFU USB tool (dfu-util).
|
* Install the DFU USB tool (dfu-util).
|
||||||
* Convert firmware from ELF to BIN: `arm-none-eabi-objcopy -O binary thermostat thermostat.bin` (you can skip this step if using the BIN from Hydra)
|
* Convert firmware from ELF to BIN: `llvm-objcopy -O binary target/thumbv7em-none-eabihf/release/thermostat thermostat.bin` (you can skip this step if using the BIN from Hydra)
|
||||||
* Connect to the Micro USB connector to Thermostat below the RJ45.
|
* Connect to the Micro USB connector to Thermostat below the RJ45.
|
||||||
* Add jumper to Thermostat v2.0 across 2-pin jumper adjacent to JTAG connector.
|
* Add jumper to Thermostat v2.0 across 2-pin jumper adjacent to JTAG connector.
|
||||||
* Cycle board power to put it in DFU update mode
|
* Cycle board power to put it in DFU update mode
|
||||||
|
8
flake.lock
generated
8
flake.lock
generated
@ -2,16 +2,16 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1691421349,
|
"lastModified": 1722791413,
|
||||||
"narHash": "sha256-RRJyX0CUrs4uW4gMhd/X4rcDG8PTgaaCQM5rXEJOx6g=",
|
"narHash": "sha256-rCTrlCWvHzMCNcKxPE3Z/mMK2gDZ+BvvpEVyRM4tKmU=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "011567f35433879aae5024fc6ec53f2a0568a6c4",
|
"rev": "8b5b6723aca5a51edf075936439d9cd3947b7b2c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-23.05",
|
"ref": "nixos-24.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
12
flake.nix
12
flake.nix
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
description = "Firmware for the Sinara 8451 Thermostat";
|
description = "Firmware for the Sinara 8451 Thermostat";
|
||||||
|
|
||||||
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05;
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||||
inputs.rust-overlay = {
|
inputs.rust-overlay = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@ -47,24 +47,26 @@
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
dontFixup = true;
|
dontFixup = true;
|
||||||
|
auditable = false;
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
packages.x86_64-linux = {
|
packages.x86_64-linux = {
|
||||||
inherit thermostat;
|
inherit thermostat;
|
||||||
|
default = thermostat;
|
||||||
};
|
};
|
||||||
|
|
||||||
hydraJobs = {
|
hydraJobs = {
|
||||||
inherit thermostat;
|
inherit thermostat;
|
||||||
};
|
};
|
||||||
|
|
||||||
devShell.x86_64-linux = pkgs.mkShell {
|
devShells.x86_64-linux.default = pkgs.mkShellNoCC {
|
||||||
name = "thermostat-dev-shell";
|
name = "thermostat-dev-shell";
|
||||||
buildInputs = with pkgs; [
|
packages = with pkgs; [
|
||||||
rust openocd dfu-util
|
rust llvm
|
||||||
|
openocd dfu-util
|
||||||
] ++ (with python3Packages; [
|
] ++ (with python3Packages; [
|
||||||
numpy matplotlib
|
numpy matplotlib
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
defaultPackage.x86_64-linux = thermostat;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -1,4 +1,4 @@
|
|||||||
use core::{cmp::max_by, marker::PhantomData};
|
use core::marker::PhantomData;
|
||||||
use heapless::{consts::U2, Vec};
|
use heapless::{consts::U2, Vec};
|
||||||
use num_traits::Zero;
|
use num_traits::Zero;
|
||||||
use serde::{Serialize, Serializer};
|
use serde::{Serialize, Serializer};
|
||||||
@ -561,9 +561,10 @@ impl Channels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn current_abs_max_tec_i(&mut self) -> ElectricCurrent {
|
pub fn current_abs_max_tec_i(&mut self) -> ElectricCurrent {
|
||||||
max_by(self.get_tec_i(0).abs(),
|
(0..CHANNELS)
|
||||||
self.get_tec_i(1).abs(),
|
.map(|channel| self.get_tec_i(channel).abs())
|
||||||
|a, b| a.partial_cmp(b).unwrap_or(core::cmp::Ordering::Equal))
|
.max_by(|a, b| a.partial_cmp(b).unwrap_or(core::cmp::Ordering::Equal))
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ impl Handler {
|
|||||||
|
|
||||||
fn set_fan(socket: &mut TcpSocket, fan_pwm: u32, fan_ctrl: &mut FanCtrl) -> Result<Handler, Error> {
|
fn set_fan(socket: &mut TcpSocket, fan_pwm: u32, fan_ctrl: &mut FanCtrl) -> Result<Handler, Error> {
|
||||||
if !fan_ctrl.fan_available() {
|
if !fan_ctrl.fan_available() {
|
||||||
send_line(socket, b"{ \"warning\": \"this thermostat doesn't have fan!\" }");
|
send_line(socket, b"{ \"warning\": \"this thermostat doesn't have a fan!\" }");
|
||||||
return Ok(Handler::Handled);
|
return Ok(Handler::Handled);
|
||||||
}
|
}
|
||||||
fan_ctrl.set_auto_mode(false);
|
fan_ctrl.set_auto_mode(false);
|
||||||
@ -374,7 +374,7 @@ impl Handler {
|
|||||||
|
|
||||||
fn fan_auto(socket: &mut TcpSocket, fan_ctrl: &mut FanCtrl) -> Result<Handler, Error> {
|
fn fan_auto(socket: &mut TcpSocket, fan_ctrl: &mut FanCtrl) -> Result<Handler, Error> {
|
||||||
if !fan_ctrl.fan_available() {
|
if !fan_ctrl.fan_available() {
|
||||||
send_line(socket, b"{ \"warning\": \"this thermostat doesn't have fan!\" }");
|
send_line(socket, b"{ \"warning\": \"this thermostat doesn't have a fan!\" }");
|
||||||
return Ok(Handler::Handled);
|
return Ok(Handler::Handled);
|
||||||
}
|
}
|
||||||
fan_ctrl.set_auto_mode(true);
|
fan_ctrl.set_auto_mode(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user