Compare commits
10 Commits
wip-1
...
e57ceeb149
Author | SHA1 | Date | |
---|---|---|---|
e57ceeb149 | |||
e0491fafe8 | |||
bf4ef46699 | |||
42fc0b0c62 | |||
3c3952a8a9 | |||
2f8b94ae61 | |||
d7f312ffe4 | |||
9a749c40a1 | |||
272bc49eaa | |||
b468eb8533 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
/.vscode
|
||||||
/.embuild
|
/.embuild
|
||||||
/target
|
/target
|
||||||
/Cargo.lock
|
/Cargo.lock
|
||||||
|
26
.vscode/launch.json
vendored
26
.vscode/launch.json
vendored
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"type": "probe-rs-debug",
|
|
||||||
"request": "launch",
|
|
||||||
"name": "probe-rs Test",
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"connectUnderReset": true,
|
|
||||||
"chip": "ESP32S3",
|
|
||||||
"flashingConfig": {
|
|
||||||
"flashingEnabled": true,
|
|
||||||
"haltAfterReset": true
|
|
||||||
},
|
|
||||||
"coreConfigs": [
|
|
||||||
{
|
|
||||||
"coreIndex": 0,
|
|
||||||
"programBinary": "./target/xtensa-esp32s3-espidf/debug/${workspaceFolderBasename}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
@ -11,13 +11,11 @@ name = "renderbug"
|
|||||||
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors
|
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = 3
|
opt-level = "s"
|
||||||
lto = true
|
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = true # Symbols are nice and they don't increase the size on Flash
|
debug = true # Symbols are nice and they don't increase the size on Flash
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
lto = true
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "esp-idf-svc/native", "rmt", "smart-leds"]
|
default = ["std", "esp-idf-svc/native", "rmt", "smart-leds"]
|
||||||
@ -50,7 +48,6 @@ embedded-graphics = { version = "0.8.1", optional = true, features = ["fixed_poi
|
|||||||
ansi_term = "0.12.1"
|
ansi_term = "0.12.1"
|
||||||
num = "0.4.3"
|
num = "0.4.3"
|
||||||
chrono = "0.4.38"
|
chrono = "0.4.38"
|
||||||
fugit = "0.3.7"
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
embuild = "0.32.0"
|
embuild = "0.32.0"
|
||||||
|
13
src/TODO.md
13
src/TODO.md
@ -1,15 +1,18 @@
|
|||||||
[x] cfg macros
|
[x] cfg macros
|
||||||
[ ] warnings
|
[ ] warnings
|
||||||
[x] rgb crate
|
[x] rgb crate
|
||||||
[ ] Layer blending
|
[x] Layer blending
|
||||||
[ ] Refactor idle pattern into test pattern
|
[x] Refactor idle pattern into test pattern
|
||||||
[ ] Wifi
|
[x] Wifi
|
||||||
[ ] JSON surface map loading
|
[ ] JSON surface map loading
|
||||||
[ ] Weather
|
[ ] Weather
|
||||||
[ ] Circadian Rhythm
|
[x] Circadian Rhythm
|
||||||
[ ] NTP
|
[x] NTP
|
||||||
[ ] Config to only start a subset of tasks on startup
|
[ ] Config to only start a subset of tasks on startup
|
||||||
[ ] Serial CLI
|
[ ] Serial CLI
|
||||||
[ ] Surface blending API
|
[ ] Surface blending API
|
||||||
[ ] Layer blending equations
|
[ ] Layer blending equations
|
||||||
[ ] Surface rotation
|
[ ] Surface rotation
|
||||||
|
[ ] esp8266 port
|
||||||
|
[ ] event system
|
||||||
|
[ ] threaded schedulers
|
@ -38,7 +38,7 @@ fn main() {
|
|||||||
log::info!("Creating animations");
|
log::info!("Creating animations");
|
||||||
let mut animations = FixedSizeScheduler::new([
|
let mut animations = FixedSizeScheduler::new([
|
||||||
Box::new(animations::IdleTask::new(&mut surfaces)),
|
Box::new(animations::IdleTask::new(&mut surfaces)),
|
||||||
//Box::new(animations::TestPattern::new(surfaces.new_surface(&Rectangle::everything()).unwrap())),
|
Box::new(animations::TestPattern::new(surfaces.new_surface(&Rectangle::everything()).unwrap())),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let mut renderer = FixedSizeScheduler::new([Box::new(Renderer::new(output, surfaces))]);
|
let mut renderer = FixedSizeScheduler::new([Box::new(Renderer::new(output, surfaces))]);
|
||||||
|
@ -107,6 +107,24 @@ impl<const STRIDE_NUM: usize> StrideMapping<STRIDE_NUM> {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn new_cyberplague() -> Self {
|
||||||
|
Self::from_json(&[
|
||||||
|
(0, 6, 6, false),
|
||||||
|
(1, 6, 6, true),
|
||||||
|
(2, 6, 6, false),
|
||||||
|
(3, 4, 9, true),
|
||||||
|
(4, 4, 14, false),
|
||||||
|
(5, 0, 17, true),
|
||||||
|
(6, 2, 12, false),
|
||||||
|
(7, 0, 18, true),
|
||||||
|
(8, 4, 14, false),
|
||||||
|
(9, 5, 9, true),
|
||||||
|
(10, 4, 7, false),
|
||||||
|
(11, 5, 6, true),
|
||||||
|
(12, 5, 6, false)
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
pub fn new_jar() -> Self {
|
pub fn new_jar() -> Self {
|
||||||
Self::from_json(&[
|
Self::from_json(&[
|
||||||
(0, 0, 17, false),
|
(0, 0, 17, false),
|
||||||
|
@ -175,7 +175,15 @@ impl Board for Esp32Board {
|
|||||||
std::thread::spawn(move || { FastWs2812Esp32Rmt::new(peripherals.rmt.channel0, pins.gpio5).unwrap() }).join().unwrap(),
|
std::thread::spawn(move || { FastWs2812Esp32Rmt::new(peripherals.rmt.channel0, pins.gpio5).unwrap() }).join().unwrap(),
|
||||||
MAX_POWER_MW
|
MAX_POWER_MW
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
|
[0xfc, 0xf5, 0xc4, 0x05, 0xb8, 0x30, 0x0, 0x0] => { // cyberplague
|
||||||
|
StrideOutput::new(
|
||||||
|
Pixbuf::new(),
|
||||||
|
StrideMapping::new_cyberplague(),
|
||||||
|
std::thread::spawn(move || { FastWs2812Esp32Rmt::new(peripherals.rmt.channel0, pins.gpio13).unwrap() }).join().unwrap(),
|
||||||
|
MAX_POWER_MW
|
||||||
|
)
|
||||||
|
},
|
||||||
_ => {
|
_ => {
|
||||||
StrideOutput::new(
|
StrideOutput::new(
|
||||||
Pixbuf::new(),
|
Pixbuf::new(),
|
||||||
@ -265,9 +273,9 @@ impl CircadianRhythm {
|
|||||||
adjusted_end.hour += 24;
|
adjusted_end.hour += 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
let start_time = start.hour * 60;
|
let start_time = (start.hour as u16).wrapping_mul(60);
|
||||||
let end_time = end.hour * 60;
|
let end_time = (end.hour as u16).wrapping_mul(60);
|
||||||
let now_time = hour * 60 + minute;
|
let now_time = (hour as u16).wrapping_mul(60).wrapping_add(minute as u16);
|
||||||
|
|
||||||
let duration = end_time - start_time;
|
let duration = end_time - start_time;
|
||||||
let cur_duration = now_time - start_time;
|
let cur_duration = now_time - start_time;
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
use rgb::Rgb;
|
|
||||||
use super::smart_leds_lib::rmt::FastWs2812Esp32Rmt;
|
|
||||||
use super::smart_leds_lib::StrideOutput;
|
|
||||||
|
|
||||||
use crate::task::{FixedSizeScheduler, Task};
|
|
||||||
use crate::buffers::StaticSurfacePool;
|
|
||||||
|
|
||||||
use super::Board;
|
|
||||||
|
|
||||||
pub struct Esp32Board<'a> {
|
|
||||||
output: Option<<Self as Board>::Output>,
|
|
||||||
surfaces: Option<StaticSurfacePool>,
|
|
||||||
tasks: Option<[&'a mut dyn Task; 1]>
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Board for Esp32Board<'a> {
|
|
||||||
type Output = StrideOutput<[Rgb<u8>; 310], FastWs2812Esp32Rmt<'a>>;
|
|
||||||
type Surfaces = StaticSurfacePool;
|
|
||||||
type Scheduler = FixedSizeScheduler<0>;
|
|
||||||
fn take() -> Self {
|
|
||||||
let peripherals = esp_hal::init(esp_hal::Config::default());
|
|
||||||
//esp_alloc::heap_allocator!(72 * 1024);
|
|
||||||
|
|
||||||
const POWER_VOLTS : u32 = 5;
|
|
||||||
const POWER_MA : u32 = 500;
|
|
||||||
const MAX_POWER_MW : u32 = POWER_VOLTS * POWER_MA;
|
|
||||||
let pins = peripherals.pins;
|
|
||||||
|
|
||||||
|
|
||||||
Esp32Board { output: None, surfaces: None, tasks: None }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn output(&mut self) -> Self::Output {
|
|
||||||
self.output.take().unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn surfaces(&mut self) -> Self::Surfaces {
|
|
||||||
self.surfaces.take().unwrap()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn system_tasks(&mut self) -> Self::Scheduler {
|
|
||||||
FixedSizeScheduler::new([])
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user