Skip to content

Commit

Permalink
ESP32: Fix reset() causing meditation error (ref #1777)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed May 3, 2023
1 parent 95fb716 commit 4b33eba
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
Correctly handle parsing of template literals inside template literals
Don't store command history if echo=off (eg for Web IDE/App Loader uploads)
E.defrag now kicks the watchdog (on Bangle.js 2 it can take long enough that the watchdog fires)
ESP32: Fix reset() causing meditation error (ref #1777)

2v14 : Bangle.js2: Fix issue with E.showMenu creating a global `s` variable
Bangle.js2: Recheck string wrapping after font change inside E.showMenu
Expand Down
7 changes: 6 additions & 1 deletion make/targets/ESP32.make
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ ESP_ZIP = $(PROJ_NAME).tgz

COMPORT?=/dev/ttyUSB0

$(PROJ_NAME).bin: $(OBJS)
$(PROJ_NAME).elf: $(OBJS)
$(LD) $(LDFLAGS) -o $(PROJ_NAME).elf -Wl,--start-group $(LIBS) $(OBJS) -Wl,--end-group

$(PROJ_NAME).bin: $(PROJ_NAME).elf
python $(ESP_IDF_PATH)/components/esptool_py/esptool/esptool.py \
--chip esp32 \
elf2image \
Expand All @@ -12,6 +14,9 @@ $(PROJ_NAME).bin: $(OBJS)
-o $(PROJ_NAME).bin \
$(PROJ_NAME).elf

$(PROJ_NAME).lst : $(PROJ_NAME).elf
$(OBJDUMP) -d -l -x $(PROJ_NAME).elf > $(PROJ_NAME).lst

$(ESP_ZIP): $(PROJ_NAME).bin
$(Q)rm -rf $(PROJ_NAME)
$(Q)mkdir -p $(PROJ_NAME)
Expand Down
3 changes: 2 additions & 1 deletion src/jsinteractive.c
Original file line number Diff line number Diff line change
Expand Up @@ -2236,10 +2236,11 @@ void jsiIdle() {
JsiStatus s = jsiStatus;
if ((s&JSIS_TODO_RESET) == JSIS_TODO_RESET) {
// shut down everything and start up again
unsigned int oldJsVarsSize = jsVarsSize; // we must remember the old vars size - mainly for ESP32 where it can change
jsiKill();
jsvKill();
jshReset();
jsvInit(0);
jsvInit(oldJsVarsSize);
jsiSemiInit(false, NULL/* no filename */); // don't autoload
jsiStatus &= (JsiStatus)~JSIS_TODO_RESET;
}
Expand Down
8 changes: 5 additions & 3 deletions src/jsvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,11 @@ void jsvFree(void *ptr);
} \
}

#endif /* JSVAR_H_ */

#if defined(JSVAR_MALLOC) && defined(ESPR_EMBED)
#if defined(JSVAR_MALLOC)
extern unsigned int jsVarsSize;
extern JsVar *jsVars;
#endif

#endif /* JSVAR_H_ */


3 comments on commit 4b33eba

@MaBecker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks!

@SimonGAndrews
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry just curious ... why has this fix gone in the change log under version 2v15 ?

@gfwilliams
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why has this fix gone in the change log under version 2v15 ?

Because I'm an idiot - there's another commit which puts in back in the right place later :)

Please sign in to comment.