Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ The version lives in `_VER` in `src/main.c`. Binaries are published only as the
[`latest`](https://github.com/OpenIPC/microsnander/releases/latest) release, rebuilt
from every push to `main`; this file is the change history.

## 1.43.1 — 2026-11-16

- Web mode, hex view: an answer that comes after a newer request changes nothing (before, it could
still set the dump size or go back to address 0, and Go then refused a valid address); a state
with no dump (the service started again) hides the panel instead of keeping the old bytes.

## 1.43.0 — 2026-11-16

- Android app: a hex view of the last dump (#85), under the status registers, as in the web
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
struct flash_cmd prog;
extern unsigned int bsize;

#define _VER "1.43.0"
#define _VER "1.43.1"

const char *ms_version = _VER;

Expand Down
6 changes: 4 additions & 2 deletions src/web_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ <h1>MicroSNANDer Web</h1>
sr.forEach(function(v,i){h+='<div class="name">SR'+(i+1)+'</div>';names[i].forEach(function(n,k){var on=(v>>(7-k))&1;h+='<div class="bit"><span class="bulb'+(on?(protect[n]?' on':' ok'):'')+'"></span>'+n+'</div>'})});
$('regs').innerHTML=h;
}else if(!s.busy&&['detect','registers','unprotect'].indexOf(s.op)>=0)$('regpanel').hidden=true;
if(s.file&&!s.busy)hexOpen(s.file);
if(!s.busy){if(s.file)hexOpen(s.file);else hexClose()} /* no dump: the service started again */
if(!s.busy&&lastOp==='read'&&s.op==='read'&&s.ok&&s.file){lastOp='';location.href=base+'/dumps/'+encodeURIComponent(s.file)}
if(!document.body.classList.contains('ready'))setTimeout(function(){document.body.classList.add('ready')},50); /* the first state is shown at once */
if(s.busy&&!timer)timer=setInterval(poll,500);
Expand All @@ -209,15 +209,17 @@ <h1>MicroSNANDer Web</h1>
/* the hex view of the last dump: 512 bytes a page, read with Range */
var hx={file:'',off:0,size:0,req:0},HXP=512;
function h2(v,n){var s=v.toString(16).toUpperCase();while(s.length<n)s='0'+s;return s}
function hexClose(){if(!hx.file)return;hx.file='';hx.off=hx.size=0;hx.req++;$('hexpanel').hidden=true;$('hex').textContent=''}
function hexOpen(f){if(f===hx.file)return;hx.file=f;hx.off=0;hx.size=0;$('hexfile').textContent=f;$('hexpanel').hidden=false;hexLoad()}
function hexLoad(){
var a=hx.off,my=++hx.req; /* only the last request is shown: an older answer is dropped */
fetch(base+'/dumps/'+encodeURIComponent(hx.file),{headers:{Range:'bytes='+a+'-'+(a+HXP-1)},cache:'no-store'}).then(function(r){
if(my!==hx.req)return null; /* an older answer changes nothing: not the size, not the address */
if(r.status===416){hx.off=0;throw 'Past the end of the dump: press Go for an address inside it.'}
if(r.status!==206)throw 'The dump cannot be read here.';
var cr=r.headers.get('Content-Range');if(cr)hx.size=parseInt(cr.split('/')[1],10);
return r.arrayBuffer();
}).then(function(b){if(my===hx.req)hexDraw(new Uint8Array(b),a)}).catch(function(e){if(my===hx.req)$('hex').textContent=typeof e==='string'?e:'No link.'});
}).then(function(b){if(b&&my===hx.req)hexDraw(new Uint8Array(b),a)}).catch(function(e){if(my===hx.req)$('hex').textContent=typeof e==='string'?e:'No link.'});
}
function hexDraw(u,a){
var h='';
Expand Down
7 changes: 4 additions & 3 deletions tests/websim.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ int main(void)
"GET / gives the page");
check(strstr(body_of(), "if(s.seq<seen&&s.seq!==0)return") != NULL, " an older state does not replace a newer one on the page");
check(strstr(body_of(), "id=\"hexpanel\"") && strstr(body_of(), "Range:'bytes='+a+'-'+(a+HXP-1)") &&
strstr(body_of(), "if(s.file&&!s.busy)hexOpen(s.file)") && strstr(body_of(), "if(my===hx.req)hexDraw(") &&
strstr(body_of(), "[0-9a-f]{1,12}$/i") && strstr(body_of(), "if(hx.size&&n>=hx.size)"),
" the hex view of the last dump, read with Range, only the last answer shown");
strstr(body_of(), "if(b&&my===hx.req)hexDraw(") &&
strstr(body_of(), "[0-9a-f]{1,12}$/i") && strstr(body_of(), "if(hx.size&&n>=hx.size)") &&
strstr(body_of(), "if(my!==hx.req)return null;") && strstr(body_of(), "if(s.file)hexOpen(s.file);else hexClose()"),
" the hex view of the last dump, read with Range, only the last answer used, hidden with no dump");
check(strstr(body_of(), "function detectThen") && strstr(body_of(), "(o==='erase'||o==='write'||o==='selftest'||o==='unprotect')&&!s.chip"),
" Erase and Write wait for a chip: off without one, a Detect before the question");

Expand Down
Loading