mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-01 10:21:59 +00:00
docs(eink): the two e-ink builds in the docs and the site's sim
Docs: the E-ink section describes the landscape and portrait builds, what the tall screens add, and the settings, with three screenshots; the e-ink build flags; the release file names. Sim: each orientation gets its own factory, so a page can load both, and simEinkScale 0 leaves the canvas' CSS size to the page. CI builds both into solo-sim-wasm.zip (wasm/eink/). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -200,12 +200,13 @@ fi
|
||||
SIM_EINK="${SIM_EINK:-}"
|
||||
if [ -n "$SIM_EINK" ]; then
|
||||
case "$SIM_EINK" in
|
||||
landscape) EINK_DEFS=(-DDISPLAY_ROTATION=1 -DEINK_LARGE_FONT=1) ;;
|
||||
portrait) EINK_DEFS=(-DDISPLAY_ROTATION=0) ;;
|
||||
landscape) EINK_DEFS=(-DDISPLAY_ROTATION=1 -DEINK_LARGE_FONT=1); EXPORT_NAME=MeshCoreSimEinkLandscape ;;
|
||||
portrait) EINK_DEFS=(-DDISPLAY_ROTATION=0); EXPORT_NAME=MeshCoreSimEinkPortrait ;;
|
||||
*) echo "error: SIM_EINK must be landscape or portrait" >&2; exit 1 ;;
|
||||
esac
|
||||
OUT_NAME="meshcore_sim_eink_$SIM_EINK"
|
||||
EXPORT_NAME=MeshCoreSimEink # distinct factory: web/mesh.html?a=... loads it beside MeshCoreSim
|
||||
# Distinct factories (set above): web/mesh.html?a=... loads one beside
|
||||
# MeshCoreSim, and the site loads both orientations into one page.
|
||||
kept=()
|
||||
for d in "${DEFINES[@]}"; do
|
||||
case "$d" in -DDISPLAY_CLASS=*|-DMAX_GROUP_CHANNELS=*) ;; *) kept+=("$d") ;; esac
|
||||
|
||||
@@ -174,15 +174,15 @@ SimEinkDisplay::SimEinkDisplay()
|
||||
}
|
||||
|
||||
// Sizes the page's canvas to the panel as it's turned, at Module.simEinkScale
|
||||
// (default 3) CSS pixels a pixel.
|
||||
// (default 3) CSS pixels a pixel; 0 leaves the CSS size to the page.
|
||||
static void simEinkFitCanvas(int w, int h) {
|
||||
EM_ASM({
|
||||
var tag = (typeof Module !== 'undefined' && Module['simInstanceTag']) ? Module['simInstanceTag'] : '';
|
||||
var c = document.getElementById(tag ? ('sim-canvas-' + tag) : 'sim-canvas');
|
||||
if (!c) { console.error('[sim] e-ink canvas not found in the host page'); return; }
|
||||
var k = Module.simEinkScale || 3;
|
||||
var k = ('simEinkScale' in Module) ? Module.simEinkScale : 3;
|
||||
c.width = $0; c.height = $1;
|
||||
c.style.width = ($0 * k) + 'px'; c.style.height = ($1 * k) + 'px';
|
||||
if (k) { c.style.width = ($0 * k) + 'px'; c.style.height = ($1 * k) + 'px'; }
|
||||
Module.__simCtx = c.getContext('2d');
|
||||
Module.__simCtx.imageSmoothingEnabled = false;
|
||||
Module.__einkRefreshes = Module.__einkRefreshes || 0;
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
const SimFactory = window.MeshCoreSimEink || window.MeshCoreSim;
|
||||
const SimFactory = window.MeshCoreSimEinkLandscape || window.MeshCoreSimEinkPortrait || window.MeshCoreSim;
|
||||
if (typeof SimFactory !== 'function') {
|
||||
statusEl.textContent = 'error: build/meshcore_sim.js missing or failed to load -- run variants/sim/build_wasm.sh first.';
|
||||
} else {
|
||||
|
||||
@@ -238,7 +238,7 @@
|
||||
</script>
|
||||
<script>
|
||||
const logEl = document.getElementById('log');
|
||||
const FactoryA = (opts) => (A_BUILD ? MeshCoreSimEink : MeshCoreSim)(opts);
|
||||
const FactoryA = (opts) => (window.MeshCoreSimEinkLandscape || window.MeshCoreSimEinkPortrait || MeshCoreSim)(opts);
|
||||
function log(msg) {
|
||||
const line = document.createElement('div');
|
||||
line.textContent = '[' + new Date().toISOString().substr(11, 12) + '] ' + msg;
|
||||
|
||||
Reference in New Issue
Block a user