Compare commits
1 Commits
e57ceeb149
...
wip-1
Author | SHA1 | Date | |
---|---|---|---|
7a3ea61030 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,3 @@
|
||||
/.vscode
|
||||
/.embuild
|
||||
/target
|
||||
/Cargo.lock
|
||||
/Cargo.lock
|
26
.vscode/launch.json
vendored
Normal file
26
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
// 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,11 +11,13 @@ name = "renderbug"
|
||||
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors
|
||||
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
opt-level = 3
|
||||
lto = true
|
||||
|
||||
[profile.dev]
|
||||
debug = true # Symbols are nice and they don't increase the size on Flash
|
||||
opt-level = "z"
|
||||
lto = true
|
||||
|
||||
[features]
|
||||
default = ["std", "esp-idf-svc/native", "rmt", "smart-leds"]
|
||||
@ -48,6 +50,7 @@ embedded-graphics = { version = "0.8.1", optional = true, features = ["fixed_poi
|
||||
ansi_term = "0.12.1"
|
||||
num = "0.4.3"
|
||||
chrono = "0.4.38"
|
||||
fugit = "0.3.7"
|
||||
|
||||
[build-dependencies]
|
||||
embuild = "0.32.0"
|
||||
|
13
src/TODO.md
13
src/TODO.md
@ -1,18 +1,15 @@
|
||||
[x] cfg macros
|
||||
[ ] warnings
|
||||
[x] rgb crate
|
||||
[x] Layer blending
|
||||
[x] Refactor idle pattern into test pattern
|
||||
[x] Wifi
|
||||
[ ] Layer blending
|
||||
[ ] Refactor idle pattern into test pattern
|
||||
[ ] Wifi
|
||||
[ ] JSON surface map loading
|
||||
[ ] Weather
|
||||
[x] Circadian Rhythm
|
||||
[x] NTP
|
||||
[ ] Circadian Rhythm
|
||||
[ ] NTP
|
||||
[ ] Config to only start a subset of tasks on startup
|
||||
[ ] Serial CLI
|
||||
[ ] Surface blending API
|
||||
[ ] Layer blending equations
|
||||
[ ] Surface rotation
|
||||
[ ] esp8266 port
|
||||
[ ] event system
|
||||
[ ] threaded schedulers
|
@ -38,7 +38,7 @@ fn main() {
|
||||
log::info!("Creating animations");
|
||||
let mut animations = FixedSizeScheduler::new([
|
||||
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))]);
|
||||
|
@ -107,24 +107,6 @@ 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 {
|
||||
Self::from_json(&[
|
||||
(0, 0, 17, false),
|
||||
|
@ -175,15 +175,7 @@ impl Board for Esp32Board {
|
||||
std::thread::spawn(move || { FastWs2812Esp32Rmt::new(peripherals.rmt.channel0, pins.gpio5).unwrap() }).join().unwrap(),
|
||||
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(
|
||||
Pixbuf::new(),
|
||||
@ -273,9 +265,9 @@ impl CircadianRhythm {
|
||||
adjusted_end.hour += 24;
|
||||
}
|
||||
|
||||
let start_time = (start.hour as u16).wrapping_mul(60);
|
||||
let end_time = (end.hour as u16).wrapping_mul(60);
|
||||
let now_time = (hour as u16).wrapping_mul(60).wrapping_add(minute as u16);
|
||||
let start_time = start.hour * 60;
|
||||
let end_time = end.hour * 60;
|
||||
let now_time = hour * 60 + minute;
|
||||
|
||||
let duration = end_time - start_time;
|
||||
let cur_duration = now_time - start_time;
|
||||
|
44
src/platform/esp32_nostd.rs
Normal file
44
src/platform/esp32_nostd.rs
Normal file
@ -0,0 +1,44 @@
|
||||
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