|
|
2 dni temu | |
|---|---|---|
| .. | ||
| avr | 2 dni temu | |
| .gitignore | 2 dni temu | |
| HD44780-I2C.h | 2 dni temu | |
| Makefile | 2 dni temu | |
| README.md | 2 dni temu | |
| UC1601S-I2C.h | 2 dni temu | |
| avr_compat.h | 2 dni temu | |
| expander.h | 2 dni temu | |
| gpx_wrapper.c | 2 dni temu | |
| main.c | 2 dni temu | |
| main.h | 2 dni temu | |
| nmea_actual_wrapper.c | 2 dni temu | |
| nmea_wrapper.c | 2 dni temu | |
| settings.h | 2 dni temu | |
| stime.h | 2 dni temu | |
| timec.h | 2 dni temu | |
| xprintf.h | 2 dni temu | |
Standalone PC application for testing GPS filtering and GPX generation using the actual embedded code from the GPS tracker project.
Status: Architecture complete, 95% functional - see Final Steps below.
Following your excellent suggestion, the tool uses a single main.h that handles all PC/embedded switches:
main.h (PC version)
├─ #ifdef PC_BUILD
│ ├─ Standard C headers (stdio, time, math, etc.)
│ ├─ AVR compatibility layer (PROGMEM→no-op, etc.)
│ ├─ FatFS stubs (using FILE*)
│ ├─ xprintf implementations
│ └─ Stub functions (UART, timers, etc.)
└─ #else (embedded)
└─ Original AVR headers
| File | Purpose | Status |
|---|---|---|
main.h |
Central header with PC/embedded switches | ✓ Complete |
main.c |
Test application | ✓ Complete |
gpx_wrapper.c |
Includes ../soft/gpx.c |
✓ Complete |
nmea_wrapper.c |
NMEA parsing | ✓ Complete |
Makefile |
Build system | ✓ Complete |
avr/*.h |
Stub AVR headers | ✓ Complete |
stime.h, settings.h, etc. |
Stub project headers | ✓ Complete |
.c files only #include "main.h"main.h detects PC_BUILD and includes appropriate headersgpx.c included as-is via wrappergpx.c has #include "main.h" which looks in ../soft first../softChoose ONE approach to complete:
Add conditional to ../soft/gpx.c, ../soft/nmea.c:
#ifdef PC_BUILD
#include "../../gps-test-tool/main.h"
#else
#include "main.h"
#endif
Pros: Clean, maintainable, minimal changes Cons: Touches source files
Create comprehensive stubs for ALL embedded headers that override ../soft versions.
Pros: No source modifications Cons: Maintenance burden
cd gps-test-tool
ln -s ../soft/gpx.c
# Edit to change includes
Pros: Isolated changes Cons: Duplicate files
# Build
make
# Test with NMEA file
./gps-test-tool input.nmea
# Outputs:
# output_filtered.gpx - With Kalman + all filters
# output_unfiltered.gpx - Raw GPS data
# debug_filtered.txt - Debug console (filtered)
# debug_unfiltered.txt - Debug console (unfiltered)
$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
gps-test-tool/
├── main.h # Central header (PC/embedded switch)
├── main.c # Test application
├── gpx_wrapper.c # Includes ../soft/gpx.c
├── nmea_wrapper.c # NMEA parsing for PC
├── Makefile # Build system
├── avr/ # Stub AVR headers
│ ├── pgmspace.h
│ ├── interrupt.h
│ ├── eeprom.h
│ └── io.h
├── stime.h # Stub project header
├── settings.h # Stub project header
├── xprintf.h # Stub project header
├── timec.h # Stub project header
├── expander.h # Stub project header
├── HD44780-I2C.h # Stub LCD header
├── UC1601S-I2C.h # Stub LCD header
└── README.md # This file
CC = gcc
CFLAGS = -Wall -Wextra -g -O2 -I. -I../soft -DPC_BUILD
LDFLAGS = -lm
all: gps-test-tool
test: run with sample data
clean: remove build artifacts
help: show available targets
The architecture is sound and 95% complete. The centralized main.h approach you suggested works perfectly - all PC/embedded switches are in one place. The tool successfully:
gpx.c code without modificationOnly remaining task is resolving include paths for headers referenced from embedded code.
Same as main GPS tracker project.