Proper way to terminate a HPGCC C program after using hpg_set_mode_xxxx()? - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Proper way to terminate a HPGCC C program after using hpg_set_mode_xxxx()? (/thread-19941.html) |
Proper way to terminate a HPGCC C program after using hpg_set_mode_xxxx()? - dkostan - 05-11-2023 02:05 AM I am on a HP49G+ and am using this mode: hpg_set_color(hpg_stdscreen, HPG_COLOR_BLACK); hpg_set_mode_gray16(0); Works great I can draw text, boxes, circles etc. However when ending the program it always locks up the calculator, usually a blank screen. I have tried all combination of the below calls and no luck. Does anyone know how to properly cleanup before exiting the program when using the graphics modes? Thank you in advance! WAIT_CANCEL; // wait until ON pressed hpg_cleanup(); hpg_init(); hpg_set_mode_mono(1); hpg_clear(); hpg_set_mode_mono(1); hpg_set_color(hpg_stdscreen,HPG_COLOR_BLACK); return 0; RE: Proper way to terminate a HPGCC C program after using hpg_set_mode_xxxx()? - pier4r - 05-11-2023 06:00 PM I am not sure, but maybe here there are useful examples? http://sense.net/~egan/hpgcc/ RE: Proper way to terminate a HPGCC C program after using hpg_set_mode_xxxx()? - dkostan - 05-11-2023 06:08 PM (05-11-2023 06:00 PM)pier4r Wrote: I am not sure, but maybe here there are useful examples? http://sense.net/~egan/hpgcc/ Thank you. I did look there and they just return(0); and that's its. I did find this but they say it deprecated. It was one of the things I tried (by itself) and it did not work /*! * \brief Restores the graphics hardware to the default state. * * This function is no longer required */ void hpg_cleanup(void); RE: Proper way to terminate a HPGCC C program after using hpg_set_mode_xxxx()? - dkostan - 05-11-2023 08:15 PM (05-11-2023 06:08 PM)dkostan Wrote:(05-11-2023 06:00 PM)pier4r Wrote: I am not sure, but maybe here there are useful examples? http://sense.net/~egan/hpgcc/ Solved... Note to self: Allocate enough memory for your arrays doh! So what was happening that the memory locations it overflowed into (past the array last location) was not causing the custom hpgcc app to crash but caused the calculator app/kernel to crash when returning control to it... RE: Proper way to terminate a HPGCC C program after using hpg_set_mode_xxxx()? - pier4r - 05-14-2023 10:26 AM thank you for sharing the solution/problem for future searcher (it is always good to avoid such cases, and I mean it) |