Compare commits
4 Commits
9e23b14ace
...
a332b5fcdc
Author | SHA1 | Date |
---|---|---|
Astro | a332b5fcdc | |
Astro | 83a266852a | |
Astro | f12214a4df | |
Astro | 175b88d0e6 |
11
README.md
11
README.md
|
@ -77,3 +77,14 @@ The scope of this setting is per TCP session.
|
||||||
| `save` | Save configuration to EEPROM |
|
| `save` | Save configuration to EEPROM |
|
||||||
| `reset` | Reset the device |
|
| `reset` | Reset the device |
|
||||||
| `ipv4 <X.X.X.X>` | Configure IPv4 address |
|
| `ipv4 <X.X.X.X>` | Configure IPv4 address |
|
||||||
|
|
||||||
|
|
||||||
|
## USB
|
||||||
|
|
||||||
|
The firmware includes experimental support for acting as a USB-Serial
|
||||||
|
peripheral. Debug logging will be sent there by default (unless build
|
||||||
|
with logging via semihosting.)
|
||||||
|
|
||||||
|
**Caveat:** This logging does not flush its output. Doing so would
|
||||||
|
hang indefinitely if the output is not read by the USB host. Therefore
|
||||||
|
output will be truncated once buffers are full.
|
||||||
|
|
|
@ -121,7 +121,7 @@ fn report_to(channel: usize, channels: &mut Channels, socket: &mut TcpSocket) ->
|
||||||
#[entry]
|
#[entry]
|
||||||
fn main() -> ! {
|
fn main() -> ! {
|
||||||
init_log();
|
init_log();
|
||||||
info!("tecpak");
|
info!("thermostat");
|
||||||
|
|
||||||
let mut cp = CorePeripherals::take().unwrap();
|
let mut cp = CorePeripherals::take().unwrap();
|
||||||
cp.SCB.enable_icache();
|
cp.SCB.enable_icache();
|
||||||
|
@ -388,9 +388,10 @@ fn main() -> ! {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Apply new IPv4 address
|
// Apply new IPv4 address
|
||||||
new_ipv4_address.map(|ipv4_address|
|
new_ipv4_address.map(|new_ipv4_address| {
|
||||||
server.set_ipv4_address(ipv4_address)
|
server.set_ipv4_address(ipv4_address);
|
||||||
);
|
ipv4_address = new_ipv4_address;
|
||||||
|
});
|
||||||
|
|
||||||
// Update watchdog
|
// Update watchdog
|
||||||
wd.feed();
|
wd.feed();
|
||||||
|
|
|
@ -52,20 +52,20 @@ impl Controller {
|
||||||
// partial
|
// partial
|
||||||
let p = f64::from(self.parameters.kp) * error;
|
let p = f64::from(self.parameters.kp) * error;
|
||||||
|
|
||||||
//integral
|
// integral
|
||||||
self.integral += error;
|
self.integral += f64::from(self.parameters.ki) * error;
|
||||||
if self.integral < self.parameters.integral_min.into() {
|
if self.integral < self.parameters.integral_min.into() {
|
||||||
self.integral = self.parameters.integral_min.into();
|
self.integral = self.parameters.integral_min.into();
|
||||||
}
|
}
|
||||||
if self.integral > self.parameters.integral_max.into() {
|
if self.integral > self.parameters.integral_max.into() {
|
||||||
self.integral = self.parameters.integral_max.into();
|
self.integral = self.parameters.integral_max.into();
|
||||||
}
|
}
|
||||||
let i = f64::from(self.parameters.ki) * f64::from(self.integral);
|
let i = self.integral;
|
||||||
|
|
||||||
// derivative
|
// derivative
|
||||||
let d = match self.last_input {
|
let d = match self.last_input {
|
||||||
None => 0.0,
|
None => 0.0,
|
||||||
Some(last_input) => f64::from(self.parameters.kd) * (last_input - input)
|
Some(last_input) => f64::from(self.parameters.kd) * (last_input - input),
|
||||||
};
|
};
|
||||||
self.last_input = Some(input);
|
self.last_input = Some(input);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ impl State {
|
||||||
let serial = SerialPort::new(bus);
|
let serial = SerialPort::new(bus);
|
||||||
let dev = UsbDeviceBuilder::new(bus, UsbVidPid(0x16c0, 0x27dd))
|
let dev = UsbDeviceBuilder::new(bus, UsbVidPid(0x16c0, 0x27dd))
|
||||||
.manufacturer("M-Labs")
|
.manufacturer("M-Labs")
|
||||||
.product("tecpak")
|
.product("thermostat")
|
||||||
.device_release(0x20)
|
.device_release(0x20)
|
||||||
.self_powered(true)
|
.self_powered(true)
|
||||||
.device_class(usbd_serial::USB_CLASS_CDC)
|
.device_class(usbd_serial::USB_CLASS_CDC)
|
||||||
|
|
Loading…
Reference in New Issue