From f89ffc9b0011824a955008e75208dd0c239f1266 Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Tue, 29 Aug 2023 11:54:31 +0200 Subject: [PATCH 1/9] [bootloader] Mark Epsilon 21.1.1 as safe --- bootloader/boot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootloader/boot.cpp b/bootloader/boot.cpp index 8f0a68d827e..302c761a71f 100644 --- a/bootloader/boot.cpp +++ b/bootloader/boot.cpp @@ -107,7 +107,7 @@ void Boot::bootSlot(Bootloader::Slot s) { if (!s.userlandHeader()->isOmega() && !s.userlandHeader()->isUpsilon()) { // We are trying to boot epsilon, so we check the version and show an advertisement if needed const char * version = s.userlandHeader()->version(); - const char * min = "20.4.1"; + const char * min = "21.1.2"; int versionSum = Utility::versionSum(version, strlen(version)); int minimalVersionTrigger = Utility::versionSum(min, strlen(min)); if (versionSum >= minimalVersionTrigger) { From fd159fe48955881d041cb67c1e97e17d1f420191 Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Tue, 29 Aug 2023 12:26:38 +0200 Subject: [PATCH 2/9] [bootloader] Update version number --- bootloader/interface/static/messages.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootloader/interface/static/messages.h b/bootloader/interface/static/messages.h index 3e443cf20fe..ba9da6ac669 100644 --- a/bootloader/interface/static/messages.h +++ b/bootloader/interface/static/messages.h @@ -72,7 +72,7 @@ class Messages { constexpr static const char * aboutMessage4 = "and select the OS"; constexpr static const char * aboutMessage5 = "to boot."; - constexpr static const char * bootloaderVersion = "Version 1.0.5 - FREED0M.20.4"; + constexpr static const char * bootloaderVersion = "Version 1.0.6 - FREED0M.21.1"; //USB NAMES constexpr static const char * usbUpsilonBootloader = "Upsilon Bootloader"; From 0cabec542d3aaff92d12f29c36554824d277cd0b Mon Sep 17 00:00:00 2001 From: Luminoso-256 <63971285+Luminoso-256@users.noreply.github.com> Date: Fri, 15 Sep 2023 11:12:05 -0500 Subject: [PATCH 3/9] [NSpire Simulator] Fix framebuffer in nspire port (#340) * Fix the nspire port (ergo: framebuffer functions, shift/ctrl don't corrupt things due to weird draw calls) * cleanup the k_csdk changes --- ion/src/simulator/nspire/display.cpp | 23 ++++---------------- ion/src/simulator/nspire/k_csdk.c | 3 ++- ion/src/simulator/nspire/keyboard.cpp | 3 +++ ion/src/simulator/nspire/main.cpp | 31 +-------------------------- ion/src/simulator/nspire/main.h | 2 -- ion/src/simulator/nspire/power.cpp | 8 +++++-- 6 files changed, 16 insertions(+), 54 deletions(-) diff --git a/ion/src/simulator/nspire/display.cpp b/ion/src/simulator/nspire/display.cpp index eff8185ed5d..dbd4a0022b5 100644 --- a/ion/src/simulator/nspire/display.cpp +++ b/ion/src/simulator/nspire/display.cpp @@ -21,25 +21,10 @@ void quit() { } void draw() { - // copy framebuffer - const short unsigned int * ptr = (const short unsigned int *) Ion::Simulator::Framebuffer::address(); - Gc * gcptr = get_gc(); - for (int j = 0; j < LCD_HEIGHT_PX; ++j) { - for (int i = 0; i < LCD_WIDTH_PX;){ - int c = *ptr; - int k = 1; - for (; k+i < LCD_WIDTH_PX; ++k) { - if (ptr[k]!=c) { - break; - } - } - gui_gc_setColor(*gcptr,c_rgb565to888(c)); - gui_gc_drawRect(*gcptr,i,j,k-1,0); - ptr += k; - i += k; - } - } - sync_screen(); + unsigned short * ionFramebuffer = (unsigned short *) Ion::Simulator::Framebuffer::address(); + // we specify the screen fmt here because the "native" fmt varies between calculator revisions + // some default to a 240x320 specification, which results in a 90-degree framebuffer rotation and other terribleness. + lcd_blit(ionFramebuffer,SCR_320x240_565); } } diff --git a/ion/src/simulator/nspire/k_csdk.c b/ion/src/simulator/nspire/k_csdk.c index 4e9521f25ff..6c1accc8c39 100755 --- a/ion/src/simulator/nspire/k_csdk.c +++ b/ion/src/simulator/nspire/k_csdk.c @@ -617,7 +617,7 @@ void statusline(int mode){ #include "k_defs.h" void sdk_init(void){ - lcd_init(lcd_type()); // clrscr(); + lcd_init(lcd_type()); } void sdk_end(void){ @@ -993,6 +993,7 @@ int nspire_shift=0; int nspire_ctrl=0; int nspire_select=false; void statusline(int mode){ + return; //this is broken for our purposes and it honestly doesn't matter enough to fix. char *msg=0; if (nspire_ctrl){ if (nspire_shift) diff --git a/ion/src/simulator/nspire/keyboard.cpp b/ion/src/simulator/nspire/keyboard.cpp index 65df840a99e..15e993f0d02 100644 --- a/ion/src/simulator/nspire/keyboard.cpp +++ b/ion/src/simulator/nspire/keyboard.cpp @@ -261,6 +261,9 @@ State scan() { return state; } } + if (isKeyPressed(KEY_NSPIRE_TENX)){ + exit(0); + } return state; } diff --git a/ion/src/simulator/nspire/main.cpp b/ion/src/simulator/nspire/main.cpp index 4ed2bafd471..cfde0d41253 100644 --- a/ion/src/simulator/nspire/main.cpp +++ b/ion/src/simulator/nspire/main.cpp @@ -25,7 +25,7 @@ extern "C" { int calculator=4; // -1 means OS not checked, 0 unknown, 1 cg50 or 90, 2 emu 50 or 90, 3 other int main() { - sdk_init(); + sdk_init(); //this calls the lcd init functions from behind the scenes Ion::Simulator::Main::init(); ion_main(0, NULL); Ion::Simulator::Main::quit(); @@ -63,35 +63,6 @@ void quit() { Ion::Simulator::Display::quit(); } -void runPowerOffSafe(void (*powerOffSafeFunction)(), bool prepareVRAM) { - // somewhat OFF by setting LCD to 0 - unsigned NSPIRE_CONTRAST_ADDR=is_cx2?0x90130014:0x900f0020; - unsigned oldval=*(volatile unsigned *)NSPIRE_CONTRAST_ADDR,oldval2; - if (is_cx2){ - oldval2=*(volatile unsigned *) (NSPIRE_CONTRAST_ADDR+4); - *(volatile unsigned *) (NSPIRE_CONTRAST_ADDR+4)=0xffff; - } - *(volatile unsigned *)NSPIRE_CONTRAST_ADDR=is_cx2?0xffff:0x100; - static volatile uint32_t *lcd_controller = (volatile uint32_t*) 0xC0000000; - lcd_controller[6] &= ~(0b1 << 11); - loopsleep(20); - lcd_controller[6] &= ~ 0b1; - unsigned NSPIRE_RTC_ADDR=0x90090000; - unsigned offtime=* (volatile unsigned *) NSPIRE_RTC_ADDR; - for (int n=0;!on_key_pressed();++n){ - loopsleep(100); - idle(); - } - lcd_controller[6] |= 0b1; - loopsleep(20); - lcd_controller[6]|= 0b1 << 11; - if (is_cx2) - *(volatile unsigned *)(NSPIRE_CONTRAST_ADDR+4)=oldval2; - *(volatile unsigned *)NSPIRE_CONTRAST_ADDR=oldval; - sync_screen(); - -} - } } } diff --git a/ion/src/simulator/nspire/main.h b/ion/src/simulator/nspire/main.h index 4ac441a065f..7a9e232f0d4 100644 --- a/ion/src/simulator/nspire/main.h +++ b/ion/src/simulator/nspire/main.h @@ -11,8 +11,6 @@ void quit(); void setNeedsRefresh(); void refresh(); -void runPowerOffSafe(void (*powerOffSafeFunction)(), bool prepareVRAM); - } } } diff --git a/ion/src/simulator/nspire/power.cpp b/ion/src/simulator/nspire/power.cpp index e14daa6a88f..63560c5734f 100644 --- a/ion/src/simulator/nspire/power.cpp +++ b/ion/src/simulator/nspire/power.cpp @@ -11,12 +11,16 @@ void powerOff(void){ namespace Ion { namespace Power { +//NOTE: These should probably be reimplemented at some point +//the prior version was a janky mess that flickered a ton on wake +//and was generally awfulness. + void suspend(bool checkIfOnOffKeyReleased) { - Simulator::Main::runPowerOffSafe(powerOff, true); + // Simulator::Main::runPowerOffSafe(powerOff, true); } void standby() { - Simulator::Main::runPowerOffSafe(powerOff, true); + // Simulator::Main::runPowerOffSafe(powerOff, true); } } From a0583aa2a9ea416f6b9cdfe8acbb30b170707a7a Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Thu, 28 Sep 2023 20:38:40 +0200 Subject: [PATCH 4/9] [python] Prevent waiting for 2^32 ms if user entered a negative delay This is due to a missing check in the interruptible sleep function which was not checking if the delay was negative, then was passed to the Ion::Timing::usleep function, who only takes signed values --- python/port/helpers.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/port/helpers.cpp b/python/port/helpers.cpp index 1a425556fdc..35e33902604 100644 --- a/python/port/helpers.cpp +++ b/python/port/helpers.cpp @@ -33,6 +33,11 @@ void micropython_port_vm_hook_refresh_print() { } bool micropython_port_interruptible_msleep(int32_t delay) { + // Check if the user entered a bad delay (negative) + if (delay < 0) { + return false; + } + assert(delay >= 0); /* We don't use millis because the systick drifts when changing the HCLK * frequency. */ From 0f2ce293d185c192d6c7983b387e0670e8a69238 Mon Sep 17 00:00:00 2001 From: Rathmox <55508107+Rathmox@users.noreply.github.com> Date: Mon, 2 Oct 2023 21:12:43 +0200 Subject: [PATCH 5/9] Mark 21.2.0 as safe (#342) * Mark 21.2.0 as safe * Update messages.h --- bootloader/boot.cpp | 2 +- bootloader/interface/static/messages.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bootloader/boot.cpp b/bootloader/boot.cpp index 302c761a71f..8734d757644 100644 --- a/bootloader/boot.cpp +++ b/bootloader/boot.cpp @@ -107,7 +107,7 @@ void Boot::bootSlot(Bootloader::Slot s) { if (!s.userlandHeader()->isOmega() && !s.userlandHeader()->isUpsilon()) { // We are trying to boot epsilon, so we check the version and show an advertisement if needed const char * version = s.userlandHeader()->version(); - const char * min = "21.1.2"; + const char * min = "21.2.1"; int versionSum = Utility::versionSum(version, strlen(version)); int minimalVersionTrigger = Utility::versionSum(min, strlen(min)); if (versionSum >= minimalVersionTrigger) { diff --git a/bootloader/interface/static/messages.h b/bootloader/interface/static/messages.h index ba9da6ac669..39a74413099 100644 --- a/bootloader/interface/static/messages.h +++ b/bootloader/interface/static/messages.h @@ -72,7 +72,7 @@ class Messages { constexpr static const char * aboutMessage4 = "and select the OS"; constexpr static const char * aboutMessage5 = "to boot."; - constexpr static const char * bootloaderVersion = "Version 1.0.6 - FREED0M.21.1"; + constexpr static const char * bootloaderVersion = "Version 1.0.7 - FREED0M.21.2"; //USB NAMES constexpr static const char * usbUpsilonBootloader = "Upsilon Bootloader"; From 2bf46f59cee1aaa7b8296741f814341906b953c6 Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Mon, 16 Oct 2023 19:35:31 +0200 Subject: [PATCH 6/9] =?UTF-8?q?[apps=5Fcontainer]=20Avoid=20crashing=20on?= =?UTF-8?q?=20=C3=9710^=20on=20N0100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/apps_container_storage.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/apps_container_storage.cpp b/apps/apps_container_storage.cpp index 25953f269bc..6a945af111e 100644 --- a/apps/apps_container_storage.cpp +++ b/apps/apps_container_storage.cpp @@ -34,6 +34,11 @@ App::Snapshot * AppsContainerStorage::appSnapshotAtIndex(int index) { }; assert(sizeof(snapshots)/sizeof(snapshots[0]) == k_numberOfCommonApps); assert(index >= 0 && index < k_numberOfCommonApps); + // To avoid crashes, we return the home app snapshot if the index is out of + // bounds. (no crash in release mode, but an assert in debug mode) + if (index >= k_numberOfCommonApps) { + return snapshots[0]; + } return snapshots[index]; } From 7f2ba08761dab4686317155c40e3eb508cc97a35 Mon Sep 17 00:00:00 2001 From: Rathmox <55508107+Rathmox@users.noreply.github.com> Date: Fri, 20 Oct 2023 19:03:52 +0200 Subject: [PATCH 7/9] Mark 21.3.0 as safe (#347) * Mark 21.3.0 as safe * set to FREEDOM 21.3 --- bootloader/boot.cpp | 2 +- bootloader/interface/static/messages.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bootloader/boot.cpp b/bootloader/boot.cpp index 8734d757644..16554b9d449 100644 --- a/bootloader/boot.cpp +++ b/bootloader/boot.cpp @@ -107,7 +107,7 @@ void Boot::bootSlot(Bootloader::Slot s) { if (!s.userlandHeader()->isOmega() && !s.userlandHeader()->isUpsilon()) { // We are trying to boot epsilon, so we check the version and show an advertisement if needed const char * version = s.userlandHeader()->version(); - const char * min = "21.2.1"; + const char * min = "21.3.1"; int versionSum = Utility::versionSum(version, strlen(version)); int minimalVersionTrigger = Utility::versionSum(min, strlen(min)); if (versionSum >= minimalVersionTrigger) { diff --git a/bootloader/interface/static/messages.h b/bootloader/interface/static/messages.h index 39a74413099..d405846c080 100644 --- a/bootloader/interface/static/messages.h +++ b/bootloader/interface/static/messages.h @@ -72,7 +72,7 @@ class Messages { constexpr static const char * aboutMessage4 = "and select the OS"; constexpr static const char * aboutMessage5 = "to boot."; - constexpr static const char * bootloaderVersion = "Version 1.0.7 - FREED0M.21.2"; + constexpr static const char * bootloaderVersion = "Version 1.0.8 - FREED0M.21.3"; //USB NAMES constexpr static const char * usbUpsilonBootloader = "Upsilon Bootloader"; From 9ac62c0496161cbde09edb7c9ffae7988f984e5f Mon Sep 17 00:00:00 2001 From: AngeDieu <106985774+AngeDieu@users.noreply.github.com> Date: Sat, 11 Nov 2023 18:27:58 +0100 Subject: [PATCH 8/9] add factorial to toolbox -> combinatorics (#348) * add factorial to toolbox -> combinatorics * Update math_toolbox.cpp removed newline for format purpose --- apps/math_toolbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/math_toolbox.cpp b/apps/math_toolbox.cpp index 1d4900c9785..6548cea2e2a 100644 --- a/apps/math_toolbox.cpp +++ b/apps/math_toolbox.cpp @@ -38,7 +38,8 @@ const ToolboxMessageTree complexChildren[] = { const ToolboxMessageTree combinatoricsChildren[] = { ToolboxMessageTree::Leaf(I18n::Message::BinomialCommandWithArg, I18n::Message::Combination), - ToolboxMessageTree::Leaf(I18n::Message::PermuteCommandWithArg, I18n::Message::Permutation) + ToolboxMessageTree::Leaf(I18n::Message::PermuteCommandWithArg, I18n::Message::Permutation), + ToolboxMessageTree::Leaf(I18n::Message::FactorialCommandWithArg, I18n::Message::Factorial) }; const ToolboxMessageTree normalDistributionChildren[] = { From 458c9316f13b1db264d2243292831886262308d7 Mon Sep 17 00:00:00 2001 From: Yaya-Cout Date: Thu, 23 Nov 2023 19:21:10 +0100 Subject: [PATCH 9/9] [Ion][DFU] Restore compatibility with NumWorks website Revert product string descriptor change --- ion/src/device/shared/usb/calculator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ion/src/device/shared/usb/calculator.h b/ion/src/device/shared/usb/calculator.h index 29a7203c6b4..97c5f12813e 100644 --- a/ion/src/device/shared/usb/calculator.h +++ b/ion/src/device/shared/usb/calculator.h @@ -93,7 +93,7 @@ class Calculator : public Device { &m_webUSBPlatformDescriptor), m_languageStringDescriptor(), m_manufacturerStringDescriptor("NumWorks"), - m_productStringDescriptor("Upsilon Calculator"), + m_productStringDescriptor("NumWorks Calculator"), m_serialNumberStringDescriptor(serialNumber), m_interfaceStringDescriptor(stringDescriptor()), //m_interfaceStringDescriptor("@SRAM/0x20000000/01*256Ke"),