Compare commits

...

3 Commits

Author SHA1 Message Date
Lephenixnoir 5d51f205b9
fxcg50: officialize reserving 300 kB from _uram for the uPy GC 2024-03-18 22:10:41 +01:00
Lephenixnoir 3e2f7f0aa0
sh: slight cleanup of scheduled dupdate mechanism
Mostly renaming and integrating pe_dupdate() it with existing modules.
2024-03-18 22:08:37 +01:00
Lephenixnoir 71ddfff567
sh: switch add-in icon based on auto-detected dev builds
A dev build is detected if:
- There are dirty tracked files: "git status -uno --porcelain" nonempty
- We are not on main: "git describe" != "git describe main"
2024-03-18 22:07:59 +01:00
17 changed files with 51 additions and 37 deletions

View File

@ -12,8 +12,11 @@ SH_CONVFLAGS := --fx
all: PythonEx.g1a
PythonEx.g1a: $(BUILD)/firmware.bin icon.png
fxgxa --g1a -n PythonExtra -i icon.png $< -o $@
ICON_RELEASE := icon.png
ICON_DEV := icon-dev.png
PythonEx.g1a: $(BUILD)/firmware.bin icon.png icon-dev.png
fxgxa --g1a -n PythonExtra -i $(ICON_$(BUILDTYPE)) $< -o $@
send: all
fxlink -sw PythonEx.g1a

BIN
ports/fx9860g3/icon-dev.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,2 +1 @@
/icon.xcf
/*.g3a
/*.g3a

View File

@ -7,11 +7,14 @@ SH_LDFLAGS := -T fxcg50.ld -ljustui-cg -lm -lgint-cg -lc -lgint-cg -lgcc
SH_ASSETS := img_modifier_states.png font_9.png font_13.png font_19.png PoliceNW
SH_METADATA := fxconv-metadata.txt
SH_CONVFLAGS := --cg
all: PythonExtra.g3a
PythonExtra.g3a: $(BUILD)/firmware.bin icon-uns.png icon-sel.png
fxgxa --g3a -n PyExtra_NW --icon-uns=icon-uns.png --icon-sel=icon-sel.png $< -o $@
ICONS_RELEASE := --icon-uns=icon-uns.png --icon-sel=icon-sel.png
ICONS_DEV := --icon-uns=icon-uns-dev.png --icon-sel=icon-sel-dev.png
PythonExtra.g3a: $(BUILD)/firmware.bin
fxgxa --g3a -n PythonExtra $(ICONS_$(BUILDTYPE)) $< -o $@
send: all
fxlink -sw PythonExtra.g3a

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
ports/fxcg50/icon.xcf Normal file

Binary file not shown.

View File

@ -52,6 +52,15 @@ ifeq ($(TARGETCASIO),"FX9860G")
endif
ifeq ($(shell [[ x"$$(git describe)" == x"$$(git describe main)" ]] \
&& [[ -z "$$(git status -uno --porcelain)" ]] \
&& echo y),y)
$(info * RELEASE BUILD)
BUILDTYPE := RELEASE
else
$(info * DEVELOPMENT BUILD)
BUILDTYPE := DEV
endif
ASSETS_O := $(SH_ASSETS:%=$(BUILD)/sh_assets/%.o)

View File

@ -18,7 +18,6 @@
#include <gint/keyboard.h>
#include <gint/kmalloc.h>
#include <gint/fs.h>
#include <gint/timer.h>
#include <justui/jscene.h>
#include <justui/jlabel.h>
@ -56,14 +55,12 @@ struct pe_globals {
// TODO: Put pe_globals in a header for use by the loop hook in mpconfigport.h
widget_shell *pe_shell;
/* Whether a delayed dupdate has been scheduled asynchronously. */
bool pe_dupdate_scheduled;
struct pe_globals PE = { 0 };
// TODO : make this more clean by putting these globals into pe_globals and
// making this accessible to modules
bool is_refreshed_required = false;
//=== Hook for redirecting stdout/stderr to the shell ===//
static ssize_t stdouterr_write(void *data, void const *buf, size_t size)
@ -178,13 +175,17 @@ void pe_enter_graphics_mode(void)
PE.shell->widget.update = 0;
}
void pe_refresh_graphics(void)
void pe_schedule_dupdate(void)
{
pe_enter_graphics_mode();
pe_dupdate_scheduled = true;
}
void pe_dupdate(void)
{
/* refresh graphical output on request by setting
is_refresh_graphics to true */
dupdate();
pe_debug_run_videocapture();
is_refreshed_required = false;
pe_dupdate_scheduled = false;
}
void pe_draw(void)
@ -205,8 +206,7 @@ void pe_draw(void)
dsubimage(377, 207, &img_modifier_states, 16*icon, 0, 15, 14,
DIMAGE_NONE);
#endif
dupdate();
pe_debug_run_videocapture();
pe_dupdate();
}
//=== Application control functions ===//
@ -437,23 +437,21 @@ int main(int argc, char **argv)
gc_add(py_ram_start, py_ram_end); */
#endif
#else
/* Get everything from the OS stack (~ 350 ko) */
/* Get everything from the OS stack (~ 350 kB) */
size_t gc_area_size;
void *gc_area = kmalloc_max(&gc_area_size, "_ostk");
gc_init(gc_area, gc_area + gc_area_size);
/* Also get most of _uram; we can try and fit in the remaining ~150 kB */
void *uram_area = kmalloc(300000, "_uram");
if(uram_area)
gc_add(uram_area, uram_area + 300000);
/* Other options:
- All of _uram (leaving the OS heap for the shell/GUI/etc)
- The OS' extra VRAM
- Memory past the 2 MB boundary on tested OSes */
// gc_add(start, end)...
/* TODO : test to check if we can definitely maintain this addition of RAM */
void *uram_area = kmalloc(300000, "_uram");
if(uram_area)
gc_add(uram_area, uram_area+300000);
#endif
mp_init();

View File

@ -12,6 +12,9 @@
#include <stdlib.h>
#include <string.h>
extern void pe_enter_graphics_mode(void);
extern void pe_dupdate(void);
#ifdef FX9860G
extern font_t font_4x4;
extern font_t font_4x6;
@ -70,10 +73,8 @@ static mp_obj_t init(void)
static mp_obj_t show_screen(void)
{
void pe_enter_graphics_mode(void);
pe_enter_graphics_mode();
dupdate();
pe_debug_run_videocapture();
pe_dupdate();
return mp_const_none;
}

View File

@ -19,7 +19,8 @@
#include <gint/drivers/keydev.h>
#include <stdlib.h>
void pe_enter_graphics_mode(void);
extern void pe_enter_graphics_mode(void);
extern void pe_dupdate(void);
#define FUN_0(NAME) \
MP_DEFINE_CONST_FUN_OBJ_0(modgint_ ## NAME ## _obj, modgint_ ## NAME)
@ -230,8 +231,7 @@ STATIC mp_obj_t modgint_dclear(mp_obj_t arg1)
STATIC mp_obj_t modgint_dupdate(void)
{
pe_enter_graphics_mode();
dupdate();
pe_debug_run_videocapture();
pe_dupdate();
return mp_const_none;
}

View File

@ -109,11 +109,11 @@ void pe_after_python_exec(
/* Command executed regularly during execution */
extern void pe_draw(void);
extern widget_shell *pe_shell;
extern void pe_refresh_graphics(void);
extern bool is_refreshed_required;
extern void pe_dupdate(void);
extern bool pe_dupdate_scheduled;
#define MICROPY_VM_HOOK_LOOP \
{ if(pe_shell->widget.update) pe_draw(); \
if(is_refreshed_required) pe_refresh_graphics(); }
if(pe_dupdate_scheduled) pe_dupdate(); }
/* extra built in names to add to the global namespace
#define MICROPY_PORT_BUILTINS \

View File

@ -15,10 +15,11 @@
#include <stdlib.h>
#include <string.h>
extern void pe_schedule_dupdate(void);
extern font_t numworks;
static bool is_dwindowed;
extern bool is_refreshed_required;
#define NW_MAX_X 320
#define NW_MAX_Y 222
@ -57,7 +58,7 @@ extern bool is_refreshed_required;
// There are possibly some others to be listed correctly
static int callback(void) {
is_refreshed_required = true;
pe_schedule_dupdate();
return TIMER_CONTINUE;
}