fix: G-force longitudinal sign direction

This commit is contained in:
2026-07-27 08:27:19 +08:00
parent 5064db0032
commit b3ec4a37e2
+2 -2
View File
@@ -54,7 +54,7 @@ const M={aspect_ratio:"1:1",render_mode:"contain"};
ctx.beginPath();ctx.arc(cx,cy,r/limit,0,Math.PI*2);ctx.setLineDash([4,8]);ctx.strokeStyle='rgba(255,255,255,.08)';ctx.lineWidth=1;ctx.stroke();ctx.setLineDash([]);
// G dot
const x=Math.max(-limit,Math.min(limit,ax/G)),y=Math.max(-limit,Math.min(limit,-az/G));
const x=Math.max(-limit,Math.min(limit,ax/G)),y=Math.max(-limit,Math.min(limit,az/G));
const dx=cx+(x/limit)*r,dy=cy+(y/limit)*r;
ctx.beginPath();ctx.arc(dx,dy,Math.max(6,r/25),0,Math.PI*2);
const i=Math.sqrt(x*x+y*y)/limit;
@@ -74,7 +74,7 @@ const M={aspect_ratio:"1:1",render_mode:"contain"};
// numbers
ctx.fillStyle='rgba(255,255,255,.25)';ctx.font=`${Math.max(14,W/40)|0}px sans-serif`;ctx.textAlign='center';
ctx.fillText('Lat ' + (ax/G).toFixed(2) + 'G', cx, cy-r-20);
ctx.fillText('Long ' + (-az/G).toFixed(2) + 'G', cx, cy+r+30);
ctx.fillText('Long ' + (az/G).toFixed(2) + 'G', cx, cy+r+30);
ctx.fillText('L', cx-r-14, cy+4);ctx.fillText('R', cx+r+14, cy+4);
ctx.fillText('Brake', cx, cy-r-10);ctx.fillText('Accel', cx, cy+r+24);
}