mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 19:45:09 +00:00
TX meter: add minor tick marks between main scale labels
Power bar: minor ticks every 5% (between 0/25/50/75/100% main marks) SWR bar: minor ticks at integer values 2,3,4,6,7,8,9 (between 1/2.5/5/10) Applied to both desktop (SpectrumView) and web (paintTXMeter JS) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+24
-3
@@ -1331,7 +1331,7 @@ const
|
||||
SWR_HIGH_THRESH = 2.5;
|
||||
SWR_MAX = 10.0;
|
||||
LEFT_INFO_MIN = 62; RIGHT_PAD = 8; LABEL_PAD = 4;
|
||||
TICK_LONG = 5;
|
||||
TICK_LONG = 5; TICK_MED = 3;
|
||||
PWR_MARKS: array[0..4] of Double = (0.0, 0.25, 0.5, 0.75, 1.0);
|
||||
SWR_MARKS_VAL: array[0..3] of Double = (1.0, 2.5, 5.0, 10.0);
|
||||
SWR_MARKS_LBL: array[0..3] of string = ('1', '2.5', '5', '10');
|
||||
@@ -1468,7 +1468,19 @@ begin
|
||||
// --- Тики шкалы ---
|
||||
ACanvas.Font.Size := 6; ACanvas.Font.Style := []; ACanvas.Brush.Style := bsClear;
|
||||
|
||||
// Мощность: тики ВЫШЕ power-бара (как dBm-тики в S-метре)
|
||||
// Мощность: промежуточные тики каждые 5% (не на главных метках кратных 25%)
|
||||
i := 5;
|
||||
while i < 100 do
|
||||
begin
|
||||
if (i mod 25) <> 0 then
|
||||
begin
|
||||
X := PwrToX(i / 100.0);
|
||||
VLine(X, PY1 - TICK_MED, PY1 - 1, CLR_TICK_GREEN);
|
||||
end;
|
||||
Inc(i, 5);
|
||||
end;
|
||||
|
||||
// Мощность: главные тики с подписями (0%, 25%, 50%, 75%, 100%)
|
||||
for i := 0 to 4 do
|
||||
begin
|
||||
X := PwrToX(PWR_MARKS[i]);
|
||||
@@ -1479,7 +1491,16 @@ begin
|
||||
ACanvas.TextOut(X - TW div 2, PY1 - TICK_LONG - ACanvas.TextHeight(Lbl) - 1, Lbl);
|
||||
end;
|
||||
|
||||
// КСВ: тики НИЖЕ SWR-бара (как S-тики в S-метре)
|
||||
// КСВ: промежуточные тики на целых значениях 2,3,4,6,7,8,9
|
||||
for i := 2 to 9 do
|
||||
begin
|
||||
if i = 5 then Continue;
|
||||
X := SWRToX(i);
|
||||
if i >= 3 then VLine(X, SY2 + 1, SY2 + TICK_MED, CLR_TICK_BLUE)
|
||||
else VLine(X, SY2 + 1, SY2 + TICK_MED, CLR_TICK_GREEN);
|
||||
end;
|
||||
|
||||
// КСВ: главные тики с подписями (1, 2.5, 5, 10)
|
||||
for i := 0 to 3 do
|
||||
begin
|
||||
X := SWRToX(SWR_MARKS_VAL[i]);
|
||||
|
||||
+8
-1
@@ -504,12 +504,19 @@ begin
|
||||
'mctx.beginPath();mctx.moveTo(BX,PY1+1);mctx.lineTo(BX,PY2-1);mctx.stroke();' +
|
||||
'mctx.beginPath();mctx.moveTo(BX,SY1+1);mctx.lineTo(BX,SY2-1);mctx.stroke();' +
|
||||
// тики мощности выше power-бара
|
||||
'mctx.font="8px Courier New";' +
|
||||
'mctx.font="8px Courier New";const TICK_MED=3;' +
|
||||
// промежуточные тики каждые 5%, пропуская кратные 25%
|
||||
'for(let p=5;p<100;p+=5){if(p%25!==0){const x=pwrX(p/100);' +
|
||||
'mctx.strokeStyle="#708070";mctx.lineWidth=1;mctx.beginPath();mctx.moveTo(x,PY1-TICK_MED);mctx.lineTo(x,PY1-1);mctx.stroke();}}' +
|
||||
// главные тики с подписями
|
||||
'const pwrMarks=[0,0.25,0.5,0.75,1.0];' +
|
||||
'for(let i=0;i<pwrMarks.length;i++){const x=pwrX(pwrMarks[i]);' +
|
||||
'mctx.strokeStyle="#DCE0E0";mctx.lineWidth=1;mctx.beginPath();mctx.moveTo(x,PY1-TICK_LONG);mctx.lineTo(x,PY1-1);mctx.stroke();' +
|
||||
'const t=(pwrMarks[i]*maxW).toFixed(0),tw=mctx.measureText(t).width;' +
|
||||
'mctx.fillStyle="#DCDCD0";mctx.fillText(t,Math.round(x-tw/2),PY1-TICK_LONG-3);}' +
|
||||
// промежуточные тики КСВ на целых 2,3,4,6,7,8,9
|
||||
'for(let s=2;s<=9;s++){if(s===5)continue;const x=swrX(s),isW=s>=3;' +
|
||||
'mctx.strokeStyle=isW?"#90A070":"#708070";mctx.lineWidth=1;mctx.beginPath();mctx.moveTo(x,SY2+1);mctx.lineTo(x,SY2+TICK_MED);mctx.stroke();}' +
|
||||
// тики КСВ ниже SWR-бара
|
||||
'const swrMarks=[1,2.5,5,10],swrLbls=["1","2.5","5","10"];' +
|
||||
'for(let i=0;i<swrMarks.length;i++){const x=swrX(swrMarks[i]),isW=swrMarks[i]>=SWR_HIGH;' +
|
||||
|
||||
Reference in New Issue
Block a user