모바일 디자인 업데이트 및 quick test 에서 start 와 length 를 직접 입력할 수 있게 함

This commit is contained in:
backuppc
2026-01-26 08:33:37 +09:00
parent fb03c189b2
commit a9609da3d3
4 changed files with 41 additions and 31 deletions

14
App.tsx
View File

@@ -46,7 +46,15 @@ const App: React.FC = () => {
// Quick Action Config (Persisted in localStorage) // Quick Action Config (Persisted in localStorage)
const [quickTestConfig, setQuickTestConfig] = useState<QuickTestConfig>(() => { const [quickTestConfig, setQuickTestConfig] = useState<QuickTestConfig>(() => {
const saved = localStorage.getItem('quickTestConfig'); const saved = localStorage.getItem('quickTestConfig');
return saved ? JSON.parse(saved) : { length: 3, format: 'ascii' }; if (saved) {
const parsed = JSON.parse(saved);
return {
length: parsed.length || 3,
format: parsed.format || 'ascii',
startAddress: parsed.startAddress !== undefined ? parsed.startAddress : 2
};
}
return { length: 3, format: 'ascii', startAddress: 2 };
}); });
// Quick Action State // Quick Action State
@@ -136,14 +144,14 @@ const App: React.FC = () => {
setTimeout(() => { setTimeout(() => {
if (action === 'read') { if (action === 'read') {
addLog('INFO', `Quick Read detected tag: ${targetTag.epc}`); addLog('INFO', `Quick Read detected tag: ${targetTag.epc}`);
handleMemoryRead(MemoryBank.EPC, 2, quickTestConfig.length, "00000000", targetTag.epc); handleMemoryRead(MemoryBank.EPC, quickTestConfig.startAddress, quickTestConfig.length, "00000000", targetTag.epc);
} else if (action === 'write') { } else if (action === 'write') {
// Set Flag to trigger verification read on success // Set Flag to trigger verification read on success
performingQuickWriteRef.current = true; performingQuickWriteRef.current = true;
verificationRetriesRef.current = 0; // Reset retries verificationRetriesRef.current = 0; // Reset retries
addLog('INFO', `Quick Write detected tag: ${targetTag.epc}`); addLog('INFO', `Quick Write detected tag: ${targetTag.epc}`);
handleMemoryWrite(MemoryBank.EPC, 2, dataToWrite, "00000000", targetTag.epc); handleMemoryWrite(MemoryBank.EPC, quickTestConfig.startAddress, dataToWrite, "00000000", targetTag.epc);
} }
}, 200); }, 200);
} }

View File

@@ -29,12 +29,12 @@ export const QuickTestPanel: React.FC<Props> = ({
return ( return (
<div className="h-full flex flex-col items-center justify-center p-2 md:p-6 max-w-4xl mx-auto"> <div className="h-full flex flex-col items-center justify-center p-2 md:p-6 max-w-4xl mx-auto">
<div className="text-center mb-10"> <div className="hidden md:block text-center mb-10">
<div className="inline-flex items-center justify-center p-3 bg-indigo-100 rounded-full mb-4"> <div className="inline-flex items-center justify-center p-3 bg-indigo-100 rounded-full mb-4">
<Zap className="w-8 h-8 text-indigo-600" /> <Zap className="w-8 h-8 text-indigo-600" />
</div> </div>
<h1 className="text-3xl font-bold text-slate-800 mb-2">Quick Test Mode</h1> <h1 className="text-3xl font-bold text-slate-800 mb-2">Quick Test Mode</h1>
<p className="text-slate-500"> <p className="text-slate-500 hidden md:block">
. .
</p> </p>
</div> </div>
@@ -114,7 +114,7 @@ export const QuickTestPanel: React.FC<Props> = ({
</div> </div>
{/* Info / Config Card */} {/* Info / Config Card */}
<div className="flex flex-col justify-center space-y-6"> <div className="hidden md:flex flex-col justify-center space-y-6">
<div className="bg-white p-6 rounded-2xl shadow-sm border border-slate-200 hover:shadow-md transition-shadow"> <div className="bg-white p-6 rounded-2xl shadow-sm border border-slate-200 hover:shadow-md transition-shadow">
<h3 className="text-lg font-bold text-slate-800 mb-4 flex items-center gap-2"> <h3 className="text-lg font-bold text-slate-800 mb-4 flex items-center gap-2">
<Zap className="w-5 h-5 text-indigo-500" /> <Zap className="w-5 h-5 text-indigo-500" />
@@ -127,7 +127,7 @@ export const QuickTestPanel: React.FC<Props> = ({
</div> </div>
<div className="flex justify-between items-center p-3 bg-slate-50 rounded-lg"> <div className="flex justify-between items-center p-3 bg-slate-50 rounded-lg">
<span className="text-slate-500 text-sm">Start Address</span> <span className="text-slate-500 text-sm">Start Address</span>
<span className="font-bold text-slate-700">2 (User Data)</span> <span className="font-bold text-slate-700">{config.startAddress} (User Data)</span>
</div> </div>
<div className="flex justify-between items-center p-3 bg-slate-50 rounded-lg"> <div className="flex justify-between items-center p-3 bg-slate-50 rounded-lg">
<span className="text-slate-500 text-sm">Data Length</span> <span className="text-slate-500 text-sm">Data Length</span>
@@ -146,7 +146,7 @@ export const QuickTestPanel: React.FC<Props> = ({
Note Note
</h4> </h4>
<p> <p>
(, ) <strong>Settings</strong> . (, , ) <strong>Settings</strong> .
</p> </p>
</div> </div>
</div> </div>

View File

@@ -38,7 +38,8 @@ export const SettingsPanel: React.FC<Props> = ({
const [band, setBand] = useState<FrequencyBand>(FrequencyBand.US); const [band, setBand] = useState<FrequencyBand>(FrequencyBand.US);
// Quick Test Local State // Quick Test Local State
const [qtLength, setQtLength] = useState<3 | 4>(4); const [qtLength, setQtLength] = useState<number>(3);
const [qtStartAddress, setQtStartAddress] = useState<number>(2);
const [qtFormat, setQtFormat] = useState<'hex' | 'ascii'>('hex'); const [qtFormat, setQtFormat] = useState<'hex' | 'ascii'>('hex');
// Initialize form with reader info when available // Initialize form with reader info when available
@@ -58,6 +59,7 @@ export const SettingsPanel: React.FC<Props> = ({
useEffect(() => { useEffect(() => {
setQtLength(quickTestConfig.length); setQtLength(quickTestConfig.length);
setQtFormat(quickTestConfig.format); setQtFormat(quickTestConfig.format);
setQtStartAddress(quickTestConfig.startAddress);
}, [quickTestConfig]); }, [quickTestConfig]);
const handleApplyReaderSettings = () => { const handleApplyReaderSettings = () => {
@@ -74,7 +76,8 @@ export const SettingsPanel: React.FC<Props> = ({
const handleSaveLocalSettings = () => { const handleSaveLocalSettings = () => {
onSaveQuickTestConfig({ onSaveQuickTestConfig({
length: qtLength, length: qtLength,
format: qtFormat format: qtFormat,
startAddress: qtStartAddress
}); });
}; };
@@ -310,27 +313,25 @@ export const SettingsPanel: React.FC<Props> = ({
</p> </p>
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 mb-6"> <div className="grid grid-cols-1 md:grid-cols-2 gap-8 mb-6">
<div className="space-y-3"> <div className="space-y-3">
<label className="text-sm font-medium text-slate-600">Read/Write Length (Words)</label> <label className="text-sm font-medium text-slate-600">Start Address (Word Offset)</label>
<div className="flex items-center gap-4">
<label className="flex items-center gap-2 cursor-pointer bg-white px-4 py-2 rounded-lg border border-indigo-100 shadow-sm">
<input <input
type="radio" type="number"
checked={qtLength === 3} min={0}
onChange={() => setQtLength(3)} value={qtStartAddress}
className="w-4 h-4 text-indigo-600 focus:ring-indigo-500 border-gray-300" onChange={(e) => setQtStartAddress(parseInt(e.target.value) || 0)}
className="w-full bg-white border border-slate-300 rounded-lg px-3 py-2 text-slate-900 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none transition-all"
/> />
<span className="text-sm text-slate-700">3 Words</span>
</label>
<label className="flex items-center gap-2 cursor-pointer bg-white px-4 py-2 rounded-lg border border-indigo-100 shadow-sm">
<input
type="radio"
checked={qtLength === 4}
onChange={() => setQtLength(4)}
className="w-4 h-4 text-indigo-600 focus:ring-indigo-500 border-gray-300"
/>
<span className="text-sm text-slate-700">4 Words</span>
</label>
</div> </div>
<div className="space-y-3">
<label className="text-sm font-medium text-slate-600">Read/Write Length (Words)</label>
<input
type="number"
min={1}
value={qtLength}
onChange={(e) => setQtLength(parseInt(e.target.value) || 1)}
className="w-full bg-white border border-slate-300 rounded-lg px-3 py-2 text-slate-900 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none transition-all"
/>
</div> </div>
<div className="space-y-3"> <div className="space-y-3">

View File

@@ -46,7 +46,8 @@ export interface LogEntry {
} }
export interface QuickTestConfig { export interface QuickTestConfig {
length: 3 | 4; startAddress: number;
length: number;
format: 'hex' | 'ascii'; format: 'hex' | 'ascii';
} }