Skip to content

Commit

Permalink
Bangle.js1: Switch to space-optimised sin/atan/atan2 to save enough s…
Browse files Browse the repository at this point in the history
…pace to continue building
  • Loading branch information
gfwilliams committed Aug 29, 2024
1 parent 66fec69 commit 6a47481
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
: ESP32C3: Get analogRead working correctly
Graphics: Adjust image alignment when rotating images to avoid cropping (fix #2535)
Bangle.js1: Switch to space-optimised sin/atan/atan2 to save enough space to continue building

2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
Expand Down
2 changes: 1 addition & 1 deletion README_BuildProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ This is a partial list of definitions that can be added in a `BOARD.py` file's `

These are set automatically when `SAVE_ON_FLASH` is set (see `jsutils.h`)

* `SAVE_ON_FLASH_MATH` - Remove some less-used Maths functions that use a bunch of Flash memory
* `SAVE_ON_FLASH_MATH` - Replace some Maths functions that use a bunch of Flash memory (sin/atan/atan2/fft) with slower, smaller versions
* `ESPR_NO_GET_SET` - No Getter/setter functionality
* `ESPR_NO_OBJECT_METHODS` - No methods in objects like `{method() { ... }}`
* `ESPR_NO_PROPERTY_SHORTHAND` - No property shorthand in objects like `{a}`
Expand Down
1 change: 1 addition & 0 deletions boards/BANGLEJS.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
'DEFINES+=-DESPR_UNICODE_SUPPORT=1',
'DEFINES+=-DESPR_NO_SOFTWARE_SERIAL=1',
'DEFINES+=-DDUMP_IGNORE_VARIABLES=\'"g\\0"\'',
'DEFINES+=-DSAVE_ON_FLASH_MATH',
'DEFINES+=-DESPR_PACKED_SYMPTR', # Pack builtin symbols' offset into pointer to save 2 bytes/symbol
'DEFINES+=-DESPR_GRAPHICS_INTERNAL=1',
'DEFINES+=-DUSE_FONT_6X8 -DGRAPHICS_PALETTED_IMAGES -DGRAPHICS_ANTIALIAS -DESPR_PBF_FONTS',
Expand Down
2 changes: 1 addition & 1 deletion libs/banglejs/jswrap_bangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -5300,7 +5300,7 @@ JsVar *jswrap_banglejs_project(JsVar *latlong) {
double lon = jsvObjectGetFloatChild(latlong,"lon");
if (lat > latMax) lat=latMax;
if (lat < -latMax) lat=-latMax;
double s = sin(lat * degToRad);
double s = jswrap_math_sin(lat * degToRad);
JsVar *o = jsvNewObject();
if (o) {
jsvObjectSetChildAndUnLock(o,"x", jsvNewFromFloat(R * lon * degToRad));
Expand Down

0 comments on commit 6a47481

Please sign in to comment.