Features for log levels
This commit is contained in:
parent
8468421817
commit
bfe4839d83
1
firmware2/Cargo.lock
generated
1
firmware2/Cargo.lock
generated
|
|
@ -10,6 +10,7 @@ dependencies = [
|
||||||
"bt-hci",
|
"bt-hci",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"cc",
|
"cc",
|
||||||
|
"cfg-if",
|
||||||
"const-gen",
|
"const-gen",
|
||||||
"critical-section",
|
"critical-section",
|
||||||
"embassy-embedded-hal",
|
"embassy-embedded-hal",
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ repository = "https://github.com/haobogu/rmk"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["usb-log", "limit-fps"]
|
default = ["usb-log", "limit-fps", "warn"]
|
||||||
develop = ["limit-fps", "alt-log"]
|
develop = ["limit-fps", "alt-log"]
|
||||||
no-usb = ["rmk/_no_usb"]
|
no-usb = ["rmk/_no_usb"]
|
||||||
ble = ["rmk/esp32s3_ble"]
|
ble = ["rmk/esp32s3_ble"]
|
||||||
|
|
@ -19,6 +19,12 @@ alt-log = []
|
||||||
# Standard logging implementation over USB.
|
# Standard logging implementation over USB.
|
||||||
usb-log = ["esp-backtrace/panic-handler"]
|
usb-log = ["esp-backtrace/panic-handler"]
|
||||||
limit-fps = []
|
limit-fps = []
|
||||||
|
# Log levels (lower takes precedence)
|
||||||
|
error = []
|
||||||
|
warn = []
|
||||||
|
info = []
|
||||||
|
debug = []
|
||||||
|
trace = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rmk = { version = "0.8.2", default-features = false, features = [
|
rmk = { version = "0.8.2", default-features = false, features = [
|
||||||
|
|
@ -53,6 +59,7 @@ itertools = { version = "0.14.0", default-features = false }
|
||||||
bytemuck = "1.24.0"
|
bytemuck = "1.24.0"
|
||||||
slint = { version = "1.14.1", default-features = false, features = ["compat-1-2", "libm", "log", "unsafe-single-threaded", "renderer-software"]}
|
slint = { version = "1.14.1", default-features = false, features = ["compat-1-2", "libm", "log", "unsafe-single-threaded", "renderer-software"]}
|
||||||
critical-section = "1.2.0"
|
critical-section = "1.2.0"
|
||||||
|
cfg-if = "1.0.4"
|
||||||
|
|
||||||
# Crates for serial UART CLI
|
# Crates for serial UART CLI
|
||||||
embedded-cli = { version = "0.2.1", default-features = false, features = ["help", "macros"] }
|
embedded-cli = { version = "0.2.1", default-features = false, features = ["help", "macros"] }
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::{env, fs};
|
use std::env;
|
||||||
|
|
||||||
use const_gen::*;
|
use const_gen::*;
|
||||||
use json::JsonValue;
|
use json::JsonValue;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
//! TODO:
|
//! TODO:
|
||||||
//! * GUI event dispatch.
|
//! * GUI event dispatch.
|
||||||
//! * Avoid accessing PSRAM on second core (park it?) while flash is being written to (by vial).
|
|
||||||
//! * Async interrupt handling of keyboard input. Reduces LCD glitching.
|
//! * Async interrupt handling of keyboard input. Reduces LCD glitching.
|
||||||
//! * Attempt to reduce the size of the framebuffer to 240x960 by changing the front/back porch of
|
//! * Attempt to reduce the size of the framebuffer to 240x960 by changing the front/back porch of
|
||||||
//! the LCD driver. Reduces LCD glitching.
|
//! the LCD driver. Reduces LCD glitching.
|
||||||
//! * Bounce buffers to get rid of glitching completely.
|
//! * Bounce buffers to get rid of glitching completely.
|
||||||
//! https://esp32.com/viewtopic.php?t=28230
|
//! https://esp32.com/viewtopic.php?t=28230
|
||||||
//! https://esp32.com/viewtopic.php?f=12&t=26793&start=20#p95677
|
//! https://esp32.com/viewtopic.php?f=12&t=26793&start=20#p95677
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#![feature(macro_metavar_expr)]
|
#![feature(macro_metavar_expr)]
|
||||||
|
|
@ -19,6 +18,7 @@ use core::cell::RefCell;
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
use bt_hci::controller::ExternalController;
|
use bt_hci::controller::ExternalController;
|
||||||
|
use cfg_if::cfg_if;
|
||||||
use embassy_executor::Spawner;
|
use embassy_executor::Spawner;
|
||||||
use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex};
|
use embassy_sync::blocking_mutex::raw::{CriticalSectionRawMutex};
|
||||||
use embassy_sync::channel::Channel;
|
use embassy_sync::channel::Channel;
|
||||||
|
|
@ -83,7 +83,22 @@ mod console;
|
||||||
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
||||||
esp_bootloader_esp_idf::esp_app_desc!();
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
|
|
||||||
const LOG_LEVEL_FILTER: LevelFilter = LevelFilter::Info;
|
cfg_if! {
|
||||||
|
if #[cfg(feature = "trace")] {
|
||||||
|
const LOG_LEVEL_FILTER: LevelFilter = LevelFilter::Trace;
|
||||||
|
} else if #[cfg(feature = "debug")] {
|
||||||
|
const LOG_LEVEL_FILTER: LevelFilter = LevelFilter::Debug;
|
||||||
|
} else if #[cfg(feature = "info")] {
|
||||||
|
const LOG_LEVEL_FILTER: LevelFilter = LevelFilter::Info;
|
||||||
|
} else if #[cfg(feature = "warn")] {
|
||||||
|
const LOG_LEVEL_FILTER: LevelFilter = LevelFilter::Warn;
|
||||||
|
} else if #[cfg(feature = "error")] {
|
||||||
|
const LOG_LEVEL_FILTER: LevelFilter = LevelFilter::Error;
|
||||||
|
} else {
|
||||||
|
const LOG_LEVEL_FILTER: LevelFilter = LevelFilter::Off;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const FRAME_DURATION_MIN: Duration = Duration::from_millis(40); // 25 FPS
|
const FRAME_DURATION_MIN: Duration = Duration::from_millis(40); // 25 FPS
|
||||||
|
|
||||||
static PSRAM_ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();
|
static PSRAM_ALLOCATOR: esp_alloc::EspHeap = esp_alloc::EspHeap::empty();
|
||||||
|
|
@ -350,6 +365,7 @@ async fn main(_spawner: Spawner) {
|
||||||
|
|
||||||
let mut user_controller = UserController::new();
|
let mut user_controller = UserController::new();
|
||||||
|
|
||||||
|
// TODO: Probably want to select! instead and re-try.
|
||||||
join_all![
|
join_all![
|
||||||
// We currently send the framebuffer data using the main core, which does not seem to slow
|
// We currently send the framebuffer data using the main core, which does not seem to slow
|
||||||
// down the rest of the tasks too much.
|
// down the rest of the tasks too much.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue