Doorgaan naar hoofdcontent

Posts

Posts uit mei, 2019 weergeven

Grinder and paint make me the welder I ain't.

Flux core.

It is not going anywhere soon!

Maidenhead locator to Degrees and back again

http://www.hamradio.in/circuits/grid_locator_system.php

This code will convert a Maidenhead locator to Latitude/Longitude in degrees.
It seems that everyone tries to implement this, but I can not find any clean source code...

So here is my implementation, 2 ways, from lat,long -> maidenhead and reverse...
This is plain "C" code tested on linux, but I will include it on my STM32F4 dev board.

typedefstruct { double latitude; double longitude; int errorcode; } lat_lon_t; uint8_t to_upper(char c) { if (c >= 'a' && c <= 'z') { return c - 0x20; } return c; } // the equator and the 0 meridian are the reference // we call them +90 (instead of 0) and +180 (instead of 0) to prevent negative numbers // the world is divided into 18 * 18 fields (324 fields total) // these fields are sub-divided into squares and sub-squares and sub-sub-squares etc forever // but only 5 iterations make sense (size of a house) // and work on …