Skip to content

Commit 27fb4a8

Browse files
authored
Merge branch 'master' into defmt
2 parents 1789015 + 8acfd51 commit 27fb4a8

14 files changed

Lines changed: 104 additions & 49 deletions

File tree

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn main() {
66
let items_to_copy = [
77
"example_configs/yap_colors.toml",
88
"example_configs/yap_espflash_profiles.toml",
9+
"example_configs/yap_keybinds.toml",
910
"example_configs/macros",
1011
];
1112

example_configs/macros/example_macros.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
name = "Examples"
1+
# [[macro]]
2+
# name = "My Cool Macro" ## name in UI and for assigning macro to keybind
3+
# category = "Cool Guy Macros" ## (optional) group macros in the UI
4+
# content = "ping 1.1.1.1" ## content to send
5+
# line_ending = "\n\n\n" ## (optional) if not provided, uses the configured Macro line ending in Port Settings
6+
7+
name = "Examples" ## name is optional, if missing, will use file name
28

39
[[macro]]
410
name = "Backspace"

example_configs/macros/openshock.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "OpenShock"
1+
name = "OpenShock" ## name is optional, if missing, will use file name
22

33
[[macro]]
44
name = "Version"

example_configs/macros/openshock_setup.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "OpenShock Setup"
1+
name = "OpenShock Setup" ## name is optional, if missing, will use file name
22

33
[[macro]]
44
name = "Factory Reset"
@@ -15,13 +15,13 @@ content = "keepalive false"
1515

1616
[[macro]]
1717
name = "Setup Authtoken"
18-
content = "authtoken "
19-
sensitive = true
18+
content = 'authtoken '
19+
sensitive = true ## sensitive macro contents are hidden from view in-app
2020

2121
[[macro]]
2222
name = "Setup Networks"
23-
content = "networks "
24-
sensitive = true
23+
content = 'networks []'
24+
sensitive = true ## sensitive macro contents are hidden from view in-app
2525

2626
[[macro]]
2727
name = "CaiX Vib (ID 12345, 0.5s)"

example_configs/yap_colors.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# Color Highlight Rule Example: case-insensitive match
2+
# Example
3+
# [[regex]] ## type of rule (regex/literal)
4+
# rule = '(?i)lorem' ## rule contents
5+
# line = true ## affect the whole line if any match found within
6+
# color = "cyan" ## ansi/hex color to highlight matches (optional if any below used)
7+
# censor = false ## if true, replace the matched content (or whole line) with `*`
8+
# hide = false ## if true, remove the matched content (or whole line) entirely.
9+
10+
# Note: hidden/censored contents are still saved to log files raw.
11+
112
[[regex]]
213
rule = '^\[\s*\d+\]\[D\]\[[^\]:]+(?::\d+)?\]'
314
color = "blue"

example_configs/yap_espflash_profiles.toml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
1-
# [[elf]]
2-
# #partition_table = "../"
3-
# chip = "esp32s3"
4-
# upload_baud = 921600
1+
# .bin example
2+
# [[bin]] ## type of profile (bin/elf)
3+
# name = "PlatformIO Core v2 Build" ## name in macros and UI
4+
# 0x0 = 'C:\Users\nullstalgia\Documents\PlatformIO\Projects\OpenShock\.pio\build\OpenShock-Core-V2\bootloader.bin' ## provide an offset then a binary
5+
# 0x8000 = 'C:\Users\nullstalgia\Documents\PlatformIO\Projects\OpenShock\.pio\build\OpenShock-Core-V2\partitions.bin'
6+
# 0xe000 = 'C:\Users\nullstalgia\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin'
7+
# 0x10000 = 'C:\Users\nullstalgia\Documents\PlatformIO\Projects\OpenShock\.pio\build\OpenShock-Core-V2\app.bin'
8+
# chip = "esp32s3" ## expected chip, required. (set any_chip to true to skip check)
9+
# upload_baud = 2000000
10+
# any_chip = false ## (default: false) skip checking connected device matches expected chip
11+
# no_verify = false ## (default: false) skip verifying checksum of uploaded binaries
12+
# no_skip = false ## (default: false) don't attempt to skip sending segment by checking on-device flash checksum first
13+
14+
# .elf example
15+
# [[elf]] ## type of profile (bin/elf)
16+
# name = "PIO Elf Core v2"
17+
# path = 'C:\Users\nullstalgia\Documents\PlatformIO\Projects\OpenShock\.pio\build\OpenShock-Core-V2\app.elf' ## path to .elf to flash
18+
# partition_table = 'C:\Users\nullstalgia\Documents\PlatformIO\Projects\OpenShock\chips\partitions_4MB_OTA.csv' ## path to partition bin/csv file (optional-ish)
19+
# bootloader = 'C:\Users\nullstalgia\Documents\PlatformIO\Projects\OpenShock\.pio\build\OpenShock-Core-V2\bootloader.bin' ## path to bootloader binary (optional-ish)
20+
# chip = "esp32s3" ## expected chip, required. (set any_chip to true to skip check)
21+
# upload_baud = 2000000
22+
# any_chip = false ## (default: false) skip checking connected device matches expected chip
23+
# no_verify = false ## (default: false) skip verifying checksum of uploaded binaries
24+
# no_skip = false ## (default: false) don't attempt to skip sending segment by checking on-device flash checksum first
25+
# ram = false ## (default: false) load .elf contents into RAM, skipping flash write
526

627
[[bin]]
728
name = "PIO Core v2"

example_configs/yap_keybinds.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[keybindings]
2+
ctrl-w = "toggle-textwrap"
3+
ctrl-o = "toggle-dtr"
4+
ctrl-p = "toggle-rts"
5+
ctrl-e = "show-espflash"
6+
# ctrl-e = "reload-macros"
7+
# ctrl-e = "esp-bootloader"
8+
ctrl-t = "toggle-timestamps"
9+
ctrl-m = "show-macros"
10+
ctrl-b = "show-behavior"
11+
'ctrl-.' = "show-portsettings"
12+
ctrl-d = "toggle-indices"
13+
ctrl-f = "reload-colors"
14+
F20 = "esp-hard-reset"
15+
F21 = "esp-bootloader"
16+
shift-F21 = "esp-bootloader-unchecked"
17+
ctrl-z = "esp-bootloader-unchecked"
18+
ctrl-r = "show-rendering"
19+
ctrl-h = "toggle-hex"
20+
ctrl-l = "show-losgging"
21+
ctrl-k = "show-keybinds"
22+
23+
# macros
24+
F19 = "Restart"
25+
ctrl-s = "CaiX Vib (ID 12345, 0.5s)"
26+
ctrl-g = "OpenShock Setup|Echo Off"
27+
ctrl-j = ["PAUSE_MS:2000", "OpenShock Setup|Factory Reset", "PAUSE_MS:2000", "OpenShock Setup|Factory Reset"]
28+
29+
# espflash profiles
30+
F18 = ["Core v2 1.4.0", "pause_ms:1000", "CaiX Vib (ID 12345, 1s)", "Echo Off", "Setup Authtoken and Networks"]
31+
shift-F18 = ["esp-erase-flash", "Core v2 1.4.0"]

src/app.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ impl App {
457457
let mut max_event_handle = Duration::default();
458458
while self.is_running() {
459459
let start = Instant::now();
460+
// TODO performance widget?
460461
self.draw(&mut terminal)?;
461462
let end = Instant::now();
462463
let end1 = end.saturating_duration_since(start);
@@ -2072,8 +2073,11 @@ impl App {
20722073
}
20732074
match self.menu {
20742075
Menu::PortSelection(Pse::Ports) => {
2075-
let selected = self.ports.get(self.table_state.selected().unwrap());
2076-
if let Some(info) = selected {
2076+
if let Some(info) = self
2077+
.table_state
2078+
.selected()
2079+
.and_then(|index| self.ports.get(index))
2080+
{
20772081
info!("Port {}", info.port_name);
20782082

20792083
let baud_rate =

src/buffer/logging.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ pub struct LoggingHandle {
3838

3939
pub const DEFAULT_TIMESTAMP_FORMAT: &str = "%Y-%m-%d %H:%M:%S%.9f";
4040

41+
// TODO have a toggle in settings for
42+
// Log to file: true/false
43+
// Log to socket: true/false (later)
44+
4145
pub enum LoggingCommand {
4246
PortConnected(DateTime<Local>, SerialPortInfo, Option<ReconnectType>),
4347
PortDisconnect {

src/buffer/tui.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl Buffer {
262262
} else {
263263
// self.buflines_iter().count()
264264
//
265-
// instead inlining some of its functionality instead
265+
// inlining some of its functionality instead
266266
// to avoid .count()-ing a potentially huge iter (100k+ items)
267267
// (especially when wrapping is disabled, when its even more dead simple)
268268
// when we can just read the length of a vector

0 commit comments

Comments
 (0)