Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
feat: panic messages printed to pros terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin-Niederman committed Dec 18, 2023
1 parent 9f3e664 commit d2778d8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pros/src/vexos_env.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use alloc::format;

use crate::println;
use core::{
alloc::{GlobalAlloc, Layout},
Expand All @@ -7,6 +9,10 @@ use core::{
#[panic_handler]
pub fn panic(_info: &PanicInfo) -> ! {
println!("Panicked! {_info}");
let panic_message = alloc::ffi::CString::new(format!("Panicked! {}", _info)).unwrap();
unsafe {
pros_sys::puts(panic_message.as_ptr());
}
let panicking_task = crate::task::current();
// Make sure we eat up every cycle to stop execution
panicking_task.set_priority(crate::task::TaskPriority::High);
Expand Down

0 comments on commit d2778d8

Please sign in to comment.