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 |
|
||||
| `reset` | Reset the device |
|
||||
| `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]
|
||||
fn main() -> ! {
|
||||
init_log();
|
||||
info!("tecpak");
|
||||
info!("thermostat");
|
||||
|
||||
let mut cp = CorePeripherals::take().unwrap();
|
||||
cp.SCB.enable_icache();
|
||||
|
@ -388,9 +388,10 @@ fn main() -> ! {
|
|||
});
|
||||
|
||||
// Apply new IPv4 address
|
||||
new_ipv4_address.map(|ipv4_address|
|
||||
server.set_ipv4_address(ipv4_address)
|
||||
);
|
||||
new_ipv4_address.map(|new_ipv4_address| {
|
||||
server.set_ipv4_address(ipv4_address);
|
||||
ipv4_address = new_ipv4_address;
|
||||
});
|
||||
|
||||
// Update watchdog
|
||||
wd.feed();
|
||||
|
|
|
@ -53,19 +53,19 @@ impl Controller {
|
|||
let p = f64::from(self.parameters.kp) * error;
|
||||
|
||||
// integral
|
||||
self.integral += error;
|
||||
self.integral += f64::from(self.parameters.ki) * error;
|
||||
if self.integral < self.parameters.integral_min.into() {
|
||||
self.integral = self.parameters.integral_min.into();
|
||||
}
|
||||
if 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
|
||||
let d = match self.last_input {
|
||||
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);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ impl State {
|
|||
let serial = SerialPort::new(bus);
|
||||
let dev = UsbDeviceBuilder::new(bus, UsbVidPid(0x16c0, 0x27dd))
|
||||
.manufacturer("M-Labs")
|
||||
.product("tecpak")
|
||||
.product("thermostat")
|
||||
.device_release(0x20)
|
||||
.self_powered(true)
|
||||
.device_class(usbd_serial::USB_CLASS_CDC)
|
||||
|
|
Loading…
Reference in New Issue