A fork of pulp-os for the xteink4 adding custom apps
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

bare bare min for a new app

+101 -3
+5 -1
src/apps/home.rs
··· 188 188 1 => "Files", 189 189 2 => "Bookmarks", 190 190 3 => "Settings", 191 + 4 => "Pumpkin", 191 192 _ => "Upload", 192 193 } 193 194 } else { ··· 195 196 0 => "Files", 196 197 1 => "Bookmarks", 197 198 2 => "Settings", 199 + 3 => "Pumpkin", 198 200 _ => "Upload", 199 201 } 200 202 } ··· 207 209 1 => MenuAction::Push(AppId::Files), 208 210 2 => MenuAction::OpenBookmarks, 209 211 3 => MenuAction::Push(AppId::Settings), 212 + 4 => MenuAction::Push(AppId::Pumpkin), 210 213 _ => MenuAction::Push(AppId::Upload), 211 214 } 212 215 } else { ··· 214 217 0 => MenuAction::Push(AppId::Files), 215 218 1 => MenuAction::OpenBookmarks, 216 219 2 => MenuAction::Push(AppId::Settings), 220 + 3 => MenuAction::Push(AppId::Pumpkin), 217 221 _ => MenuAction::Push(AppId::Upload), 218 222 } 219 223 } ··· 482 486 ITEM_W, 483 487 self.ui_fonts.heading.line_height, 484 488 ); 485 - BitmapLabel::new(title_region, "pulp-os", self.ui_fonts.heading) 489 + BitmapLabel::new(title_region, "pumpkin-os", self.ui_fonts.heading) 486 490 .alignment(Alignment::Center) 487 491 .draw(strip) 488 492 .unwrap();
+12
src/apps/manager.rs
··· 6 6 7 7 use crate::apps::files::FilesApp; 8 8 use crate::apps::home::HomeApp; 9 + use crate::apps::pumpkin::PumpkinApp; 9 10 use crate::apps::reader::ReaderApp; 10 11 use crate::apps::settings::SettingsApp; 11 12 use crate::apps::{App, AppContext, AppId, Launcher, PendingSetting, Redraw, Transition}; ··· 45 46 let $app = &mut *$mgr.settings; 46 47 $body 47 48 } 49 + AppId::Pumpkin => { 50 + let $app = &mut *$mgr.pumpkin; 51 + $body 52 + } 48 53 AppId::Upload => { 49 54 unreachable!("Upload mode is handled outside the app dispatch loop"); 50 55 } ··· 72 77 let $app = &*$mgr.settings; 73 78 $body 74 79 } 80 + AppId::Pumpkin => { 81 + let $app = &*$mgr.pumpkin; 82 + $body 83 + } 75 84 AppId::Upload => { 76 85 unreachable!("Upload mode is handled outside the app dispatch loop"); 77 86 } ··· 91 100 pub files: &'static mut FilesApp, 92 101 pub reader: &'static mut ReaderApp, 93 102 pub settings: &'static mut SettingsApp, 103 + pub pumpkin: &'static mut PumpkinApp, 94 104 95 105 pub quick_menu: &'static mut QuickMenu, 96 106 pub bumps: &'static mut ButtonFeedback, ··· 106 116 files: &'static mut FilesApp, 107 117 reader: &'static mut ReaderApp, 108 118 settings: &'static mut SettingsApp, 119 + pumpkin: &'static mut PumpkinApp, 109 120 quick_menu: &'static mut QuickMenu, 110 121 bumps: &'static mut ButtonFeedback, 111 122 mapper: ButtonMapper, ··· 116 127 files, 117 128 reader, 118 129 settings, 130 + pumpkin, 119 131 quick_menu, 120 132 bumps, 121 133 mapper,
+3 -2
src/apps/mod.rs
··· 5 5 pub mod files; 6 6 pub mod home; 7 7 pub mod manager; 8 + pub mod pumpkin; 8 9 pub mod reader; 9 - pub mod widgets; 10 - 11 10 pub mod settings; 12 11 pub mod upload; 12 + pub mod widgets; 13 13 14 14 use crate::kernel::app::AppIdType; 15 15 ··· 22 22 // upload bypasses the App trait; AppManager::needs_special_mode 23 23 // returns true for this variant and run_special_mode handles it 24 24 Upload, 25 + Pumpkin, 25 26 } 26 27 27 28 impl AppIdType for AppId {
+78
src/apps/pumpkin.rs
··· 1 + use embedded_graphics_core::prelude; 2 + use esp_println::{print, println}; 3 + use pulp_kernel::{ 4 + kernel::{ 5 + App, 6 + config::{SystemSettings, WifiConfig}, 7 + }, 8 + ui::{ 9 + Alignment, CONTENT_TOP, FULL_CONTENT_W, LARGE_MARGIN, Region, SCREEN_H, SCREEN_W, TITLE_Y, 10 + }, 11 + }; 12 + 13 + use crate::{ 14 + apps::{AppId, Transition}, 15 + fonts::{self, UiFonts}, 16 + ui::BitmapLabel, 17 + }; 18 + 19 + impl Default for PumpkinApp { 20 + fn default() -> Self { 21 + Self::new() 22 + } 23 + } 24 + 25 + pub struct PumpkinApp { 26 + settings: SystemSettings, 27 + wifi: WifiConfig, 28 + ui_fonts: UiFonts, 29 + } 30 + 31 + impl PumpkinApp { 32 + pub fn new() -> Self { 33 + let uf = UiFonts::for_size(0); 34 + Self { 35 + settings: SystemSettings::defaults(), 36 + wifi: WifiConfig::empty(), 37 + ui_fonts: uf, 38 + } 39 + } 40 + } 41 + 42 + impl App<AppId> for PumpkinApp { 43 + fn on_enter( 44 + &mut self, 45 + ctx: &mut pulp_kernel::kernel::AppContext, 46 + k: &mut pulp_kernel::kernel::KernelHandle<'_>, 47 + ) { 48 + //I think this may clear the screen? 49 + ctx.mark_dirty(Region::new( 50 + 0, 51 + CONTENT_TOP, 52 + SCREEN_W, 53 + SCREEN_H - CONTENT_TOP, 54 + )); 55 + } 56 + 57 + fn on_event( 58 + &mut self, 59 + event: pulp_kernel::board::action::ActionEvent, 60 + ctx: &mut pulp_kernel::kernel::AppContext, 61 + ) -> pulp_kernel::kernel::Transition<AppId> { 62 + println!("There was some kind of event"); 63 + Transition::None 64 + } 65 + 66 + fn draw(&self, strip: &mut pulp_kernel::board::StripBuffer) { 67 + let title_region = Region::new( 68 + LARGE_MARGIN, 69 + TITLE_Y, 70 + FULL_CONTENT_W, 71 + self.ui_fonts.heading.line_height, 72 + ); 73 + BitmapLabel::new(title_region, "Pumpkin", self.ui_fonts.heading) 74 + .alignment(Alignment::CenterLeft) 75 + .draw(strip) 76 + .unwrap(); 77 + } 78 + }
+3
src/bin/main.rs
··· 17 17 use pulp_os::apps::files::FilesApp; 18 18 use pulp_os::apps::home::HomeApp; 19 19 use pulp_os::apps::manager::AppManager; 20 + use pulp_os::apps::pumpkin::PumpkinApp; 20 21 use pulp_os::apps::reader::ReaderApp; 21 22 use pulp_os::apps::settings::SettingsApp; 22 23 use pulp_os::apps::widgets::{ButtonFeedback, QuickMenu}; ··· 53 54 static HOME: StaticCell<HomeApp> = StaticCell::new(); 54 55 static FILES: StaticCell<FilesApp> = StaticCell::new(); 55 56 static SETTINGS: StaticCell<SettingsApp> = StaticCell::new(); 57 + static PUMPKIN: StaticCell<PumpkinApp> = StaticCell::new(); 56 58 57 59 #[esp_rtos::main] 58 60 async fn main(spawner: embassy_executor::Spawner) -> ! { ··· 137 139 FILES.init(FilesApp::new()), 138 140 READER.take(), 139 141 SETTINGS.init(SettingsApp::new()), 142 + PUMPKIN.init(PumpkinApp::new()), 140 143 QUICK_MENU.take(), 141 144 BUMPS.take(), 142 145 ButtonMapper::new(),