Skip to content

Commit 7d3f53e

Browse files
authored
Merge pull request #131 from MrAlders0n/copilot/fix-snr-rounding-error
Fix SNR formatting in RX wardriving API payload
2 parents c6c208a + 2bd3d39 commit 7d3f53e

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

content/wardrive.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,8 +2184,9 @@ function queueApiPost(entry) {
21842184
}
21852185

21862186
// Build unified API payload (TX-style)
2187-
// Format heard_repeats as "repeater_id(snr_avg)" - e.g., "4e(12)"
2188-
const heardRepeats = `${entry.repeater_id}(${Math.round(entry.snr_avg)})`;
2187+
// Format heard_repeats as "repeater_id(snr_avg)" - e.g., "4e(12.0)"
2188+
// Use absolute value and format with one decimal place
2189+
const heardRepeats = `${entry.repeater_id}(${Math.abs(entry.snr_avg).toFixed(1)})`;
21892190

21902191
const payload = {
21912192
key: MESHMAPPER_API_KEY,

docs/FLOW_WARDRIVE_RX_DIAGRAM.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@
188188
║ │ BUILD UNIFIED API PAYLOAD │ ║
189189
║ │ │ ║
190190
║ │ Format heard_repeats as "repeater_id(snr_avg)" │ ║
191-
║ │ Example: "92(12)" (rounded to integer) │ ║
191+
║ │ Example: "92(12.0)" (absolute value with 1 decimal) │ ║
192192
║ │ │ ║
193193
║ │ { │ ║
194194
║ │ "key": "API_KEY", │ ║
195195
║ │ "lat": 45.42150, │ ║
196196
║ │ "lon": -75.69720, │ ║
197197
║ │ "who": "DeviceName", │ ║
198198
║ │ "power": "0.6w", │ ║
199-
║ │ "heard_repeats": "92(12)", │ ║
199+
║ │ "heard_repeats": "92(12.0)", │ ║
200200
║ │ "ver": "DEV-1703257800", │ ║
201201
║ │ "session_id": "abc123", │ ║
202202
║ │ "iata": "YOW", │ ║

0 commit comments

Comments
 (0)