Commit Graph

391 Commits

Author SHA1 Message Date
Jared Boone
0cad2847f8 LogFile pass references to reduce code size a bit.
Apparently the compiler isn't optimizing away copies in places I thought it would.
2015-12-03 14:08:06 -08:00
Jared Boone
bb3cb6f080 Push packet timestamping earlier in packet handling.
Ideally, it'd get pushed back into baseband, and baseband would correct for the length of the packet (based on preamble/access code match timestamp minus preamble/access code duration) to give the exact time the packet started.
2015-12-03 14:04:20 -08:00
Jared Boone
0909cdb31e AIS: Add MMSI type. 2015-12-02 22:39:05 -08:00
Jared Boone
ad22eab3d2 Fix ERT console lack of CRLF. 2015-12-02 14:12:35 -08:00
Jared Boone
bfcd25d857 LogFile puts timestamp before entry, CRLF after. 2015-12-02 14:05:25 -08:00
Jared Boone
76845c4335 Extract to_string_* functions from ui_widget. 2015-12-02 13:38:17 -08:00
Jared Boone
d8c59e2ce2 Zero pad years < 1000 to four digits. 2015-12-02 13:23:29 -08:00
Jared Boone
b8ee19f8e6 AIS: Large refactor to separate packet decode from UI/log formatting. 2015-12-02 12:16:39 -08:00
Jared Boone
4baf2a06f2 Move ais_baseband code to app_ais. 2015-12-02 09:31:14 -08:00
Jared Boone
57aed55cc7 Extract LogFile, add (dumb) logging to ERT, AIS apps. 2015-12-01 22:39:27 -08:00
Jared Boone
29f2d0e50a Move app_spectrum_analysis.hpp code to .cpp. 2015-12-01 22:07:17 -08:00
Jared Boone
d15afc9f7d Move app_analog_audio.hpp code to .cpp. 2015-12-01 22:04:04 -08:00
Jared Boone
11e8456da0 Move app_ert.hpp code to .cpp. 2015-12-01 21:59:47 -08:00
Jared Boone
4c3b557064 Move app_tpms.hpp code to .cpp. 2015-12-01 21:53:28 -08:00
Jared Boone
61dc25e132 Move more Manchester code from .hpp to .cpp. 2015-12-01 21:47:21 -08:00
Jared Boone
1aa1286ec1 Push app_ais.hpp code into .cpp. 2015-12-01 21:44:13 -08:00
Jared Boone
ac2b62a8a7 Extract "apps". 2015-12-01 21:30:52 -08:00
Jared Boone
519f8cfebc Extract Manchester decoder, formatter. 2015-12-01 21:28:53 -08:00
Jared Boone
9a5655ad0e Removed extra methods. 2015-12-01 21:27:51 -08:00
Jared Boone
eb10532931 Remove SD card statuc handler in ReceiverView.
Wasn't doing anything useful, and probably won't.
2015-12-01 21:27:14 -08:00
Jared Boone
e9bf500bfc Move ReceiverMode enum to receiver_model.hpp 2015-12-01 21:00:31 -08:00
Jared Boone
74d6518ea1 Rename AudioModel, AudioView to Analog*. 2015-12-01 20:55:36 -08:00
Jared Boone
c1d59b644d Move baseband configuration to receiver mode classes.
Factor out the terrible switch() and clean up redundant code.
2015-12-01 20:25:57 -08:00
Jared Boone
c0db15f3e5 Replace receiver mode ordinals with enum. 2015-12-01 19:52:48 -08:00
Jared Boone
f15716a06b Move TPMS logging to file into TPMSModel class. 2015-12-01 17:42:52 -08:00
Jared Boone
f49cdfdd99 Refactor digital mode handlers into Model and View classes. 2015-12-01 17:29:54 -08:00
Jared Boone
ec977ccd05 Implement console "\n" -> crlf() behavior. 2015-12-01 17:28:22 -08:00
Jared Boone
32319ddf9f Manchester decoder bounds checking.
Return error symbol if reading past source data.
2015-12-01 16:05:23 -08:00
Jared Boone
8461b0c94e Manchester formatting to next largest length in nibbles.
Prior code insisted on next largest byte, for no good reason.
2015-12-01 15:50:07 -08:00
Jared Boone
c657ee3558 Clean up handling of bool -> int.
C++ standard says false -> 0, true -> 1.
2015-12-01 15:45:59 -08:00
Jared Boone
641b972b3e Type and name clean-up of Manchester formatter. 2015-12-01 15:41:51 -08:00
Jared Boone
7b9ba696e5 Reserve strings length before formatting Manchester data. 2015-12-01 15:36:09 -08:00
Jared Boone
810c65dd9c Return Manchester formatted output in struct. 2015-12-01 15:31:59 -08:00
Jared Boone
d75f601b54 Manchester decoder into separate class.
Now operates directly on data, doesn't make a new pair of data/error bitsets.
2015-12-01 12:05:42 -08:00
Jared Boone
426295b93e Remove unnecessary Manchester decode operation. 2015-12-01 11:50:29 -08:00
Jared Boone
82ff45860e Add basic ERT (OOK) utility meter reception.
Extracted the Manchester formatting function for use in ERT, now also returns an indication of bits in error.
2015-12-01 11:24:48 -08:00
Jared Boone
0c36a74351 Add SD card status view to receiver UI. 2015-12-01 10:45:34 -08:00
Jared Boone
c70d95dcbe Remove SDCardStatusMessage, replace with Signal, extract to separate files. 2015-12-01 10:38:35 -08:00
Jared Boone
600295f0db Add Signal for callbacks within a process (code executing on one core). 2015-12-01 10:27:46 -08:00
Jared Boone
42104d217a Broaden SD card status detail in message. 2015-11-29 15:50:58 -08:00
Jared Boone
5928086fd9 Simplify SD card mount status code. 2015-11-29 15:37:24 -08:00
Jared Boone
435824e9b5 Clean up buffer_t constructors. 2015-11-20 11:21:31 -08:00
Jared Boone
d96379dc9c Remove extra semicolons. 2015-11-20 11:11:14 -08:00
Jared Boone
600a983d5c Clean up complex<int16_t> -> complex<float> casting. 2015-11-20 11:01:41 -08:00
Jared Boone
85e984ed3b Clean up complex<int8_t> -> complex<float> casting. 2015-11-19 12:42:35 -08:00
Jared Boone
060da5d227 Add ChannelDecimator decimate by 2 and no-shift options. 2015-11-19 12:24:20 -08:00
Jared Boone
ccd64f3cd9 Add function for c8->c16 decimate by two without fs/4 shift. 2015-11-19 12:20:20 -08:00
Jared Boone
8967f0eaa1 Move common matchers to PacketBuilder. 2015-11-16 10:33:50 -08:00
Jared Boone
9900c29283 Deepen BitPattern and BitHistory to 64 bits. 2015-11-16 10:33:08 -08:00
Jared Boone
4d6877ab15 Extract FieldReader to separate header so it can be reused. 2015-11-16 10:31:36 -08:00
Jared Boone
77199fb3dd Add sdcDisconnect() to avoid HackRF mode entry crash if SD card is connected. 2015-11-13 10:55:52 -08:00
Jared Boone
6f09cf21f8 Move sdcStop() call to have symmetry with sdcStart(). 2015-11-13 10:55:08 -08:00
Jared Boone
0a9da7a1d3 Store tuned frequency and modulation characteristics in TPMS log. 2015-11-11 11:56:50 -08:00
Jared Boone
8e4e33f74e Don't show TPMS Manchester errors on LCD, truncate data to not wrap. 2015-11-11 11:56:20 -08:00
Jared Boone
19f352fa13 Log TPMS Manchester encoding errors. 2015-11-11 11:19:17 -08:00
Jared Boone
1770dff522 Finish object-izing Baseband and RSSI threads. 2015-11-11 10:54:36 -08:00
Jared Boone
4f82524e77 Another default constructor. 2015-11-11 10:30:35 -08:00
Jared Boone
d9106b6f44 Start object-ization of RSSI thread. 2015-11-11 10:11:37 -08:00
Jared Boone
19c89def75 Start to object-ize the baseband thread function. 2015-11-11 10:02:06 -08:00
Jared Boone
2c64454172 More constructor style clean-up. 2015-11-11 09:35:28 -08:00
Jared Boone
d02698a6de Apparent bug where min/max aren't initialized from value inside the buffer bounds.
The fix is less than ideal, it assumes that an incoming buffer length is always >= 1.
2015-11-11 09:30:15 -08:00
Jared Boone
ebf103363c Constructor style clean-up. 2015-11-11 09:16:20 -08:00
Jared Boone
db416fd670 Basic TPMS logging to a SD card file. 2015-11-10 15:31:46 -08:00
Jared Boone
ed585d2c15 Enable FatFs string functions. 2015-11-10 15:30:43 -08:00
Jared Boone
987ea3555d SD card detection and filesystem mounting. 2015-11-10 15:24:42 -08:00
Jared Boone
9f6c495fef Add TPMS initial demodulator implementation.
Right now, 2FSK, 19200 baud, +/-38400Hz deviation. No effort is made to check CRC/checksums or decode packets.
2015-11-10 15:19:56 -08:00
Jared Boone
6cdef7026d Remove spectrum window-presum due to lack of code RAM. 2015-11-10 15:16:27 -08:00
Jared Boone
e6351ca066 Improve comment accuracy. 2015-11-10 15:11:19 -08:00
Jared Boone
99871dcb84 Move a few member variables to stack/constants. 2015-11-10 15:10:52 -08:00
Jared Boone
791b2a9762 Remove now-unused FSKConfiguration message. 2015-11-10 15:07:20 -08:00
Jared Boone
981c2fbfbd Complete FSKProcessor's trip to being AISProcessor. 2015-11-10 15:04:38 -08:00
Jared Boone
111a5f10c0 Add some baseband constructors.
Some of them I think I took out earlier...
2015-11-10 14:04:50 -08:00
Jared Boone
add6171410 Move BasebandStatistics from heap to stack. 2015-11-10 13:59:17 -08:00
Jared Boone
0789d50fdf Rework BitHistory, BitPattern, PacketBuilder.
Templatize PacketBuilder to optionally bit unstuff, and have flexible packet termination behavior.
2015-11-09 14:38:09 -08:00
Jared Boone
0b522abbc1 Rename AIS packet handler variables for consistency with spec. 2015-11-09 14:35:06 -08:00
Jared Boone
850c847bbf Trap attempts to register more than one message handler at a time. 2015-11-09 11:57:38 -08:00
Jared Boone
47a3ffb15a Insulate ui::Context a bit from its clients.
Add accessor methods.
2015-11-09 11:56:40 -08:00
Jared Boone
85383e488b std::fma not necessary with proper compiler options.
std::fma isn't available on Ubuntu 15.04 arm-gcc, apparently. Hence my reviewing this code...
2015-11-08 16:33:32 -08:00
Jared Boone
5dcca89172 FSKProcessor: remove separate channel filter.
RRC filter alone will do the trick!
2015-11-07 14:10:44 -08:00
Jared Boone
fc037c739a Comment about correct MatchedFilter usage.
Because the filter expects a combined translate/rotate and low-pass filter in the taps, the taps must be a multiple of the translate sinusoid period.
2015-11-07 11:27:31 -08:00
Jared Boone
9e694ce836 AIS decoding and really bad UI.
The decoder needs a serious refactoring/decoupling.
The UI just dumps bits of the received packets into a console window, whcih scrolls too quickly in an AIS-dense area with a good antenna.
2015-11-06 13:53:04 -08:00
Jared Boone
a366b3ac4f CRC class.
Has some more efficient code, commented out because I was having trouble getting it to work. However, it may have been due to the particular data I was trying to decode and CRC-validate.
2015-11-06 13:49:59 -08:00
Jared Boone
ae225e8c3b Further MatchedFilter optimization using algebraic identities and stuff.
Can't stop premature optimization!!!
2015-11-06 09:40:05 -08:00
Jared Boone
100761481e Fix inaccurate comment. 2015-11-06 09:40:05 -08:00
Jared Boone
3d5c8056d9 Premature optimization of MatchedFilter::shift_by_decimation_factor(). 2015-11-06 09:40:05 -08:00
Jared Boone
4afcc83873 Mark MatchedFilter::is_new_decimation_cycle() as const. 2015-11-06 09:40:05 -08:00
Jared Boone
3c33e20156 Rename MatchedFilter::decimation_factor. 2015-11-06 09:40:05 -08:00
Jared Boone
7a59823211 Stop computing channel spectrum during FSK demod.
Data is unused, as screen is displaying decoded packets.
2015-11-06 09:40:05 -08:00
Jared Boone
ddd34793a6 Default constructors and configure methods for baseband classes. 2015-11-06 09:40:05 -08:00
Jared Boone
5236a858d0 Change Field.read to const. 2015-11-06 09:40:04 -08:00
Jared Boone
a33aa26bf5 Change header guard name. 2015-11-06 09:40:04 -08:00
Jared Boone
51df92a05a Rename baseband_ais -> ais_baseband.
So that ais_baseband and ais_application filenames can be sorted near each other.
2015-11-06 09:40:04 -08:00
Jared Boone
26c23dc8a0 Use new FIR decimation in FSK demodulator.
Reduces FIR calculation effort when output samples are skipped at FIR filter, not after.
2015-11-06 09:40:04 -08:00
Jared Boone
86b068be62 Early calculation to reduce pressure on registers. 2015-11-06 09:40:04 -08:00
Jared Boone
a074e7d8d8 Remove commented code. 2015-11-06 09:40:04 -08:00
Jared Boone
424c0eac3f FIRAndDecimateBy2Complex: expose decimation_factor, bring work function into class. 2015-11-06 09:40:04 -08:00
Jared Boone
cde15e4271 Generalize fir_and_decimate_by_2_complex_fast.
Permit decimation_factors other than 2.
Permit tap counts != 64 (but still must be multiple of 8).
Half the amount of tap memory required.
Performance is significantly degraded due to greater flexibility -- most likely due to separate sample buffer shift phase, instead of performing shift during output sample calculation.
2015-11-06 09:40:04 -08:00
Jared Boone
be78ed657f Remove taps_count template arg for FIRAndDecimateBy2Complex.
Use heap to allocate samples and taps buffers, so filters of different lengths can be supported.
2015-11-06 09:40:04 -08:00
Jared Boone
0f73d6061a Remove old decimating FIR code. 2015-11-06 09:40:04 -08:00
Jared Boone
015e5516d5 Update/consolidate AIS RRC matched filter taps. 2015-11-06 09:40:04 -08:00
Jared Boone
be94c9fa9b Switching between waterfall and console mode.
Also remove an unused Console constructor.
2015-11-06 09:40:03 -08:00
Jared Boone
d0f35cf89d Rework spectrum/console UI clearing and resetting. 2015-11-06 09:40:03 -08:00
Jared Boone
dc30911e0f Check for widget != nullptr before add/remove child. 2015-11-06 09:40:03 -08:00
Jared Boone
dab801e167 AIS RX tweak of clock recovery constant for better performance. 2015-11-06 09:40:03 -08:00
Jared Boone
58b97dea68 AIS RX performance improved with 32-tap RRC. 2015-11-06 09:40:03 -08:00
Jared Boone
f82fd1f8d7 Tease apart utility.hpp, other header dependencies.
Trying to get a host-testable FSK demodulator, and finding a lot of M4- and ChibiOS-specific code is getting included. Boo.
2015-11-06 09:40:03 -08:00
Jared Boone
e049097f49 Remove spurious commented code. 2015-11-06 09:40:03 -08:00
Jared Boone
0a7ac153a7 AIS RRC taps updated, more precision, corrected frequency shift. 2015-11-06 09:40:03 -08:00
Jared Boone
338983e7ae Remove unused negative-shifted RRC filters. 2015-11-06 09:40:03 -08:00
Jared Boone
4aae77f565 MatchedFilter improvements
Use single set of taps for positive and negative filters.
Reverse taps (since new samples are pushed into buffer from the high end).
Make complex multiply explicit to avoid fancy but irrelevant arithmetic checks.
Compute negative filter from conjugation of positive filter taps.
Move filter power and difference calculations into MatchedFilter.
2015-11-06 09:40:03 -08:00
Jared Boone
ab28639a3d Use std::move to move samples in buffer.
Yes, std::rotate works, but it's fancy and does unnecessary work.
2015-11-06 09:40:02 -08:00
Jared Boone
4141d6fe0f Untemplate MatchedFilter, a different way. 2015-11-06 09:40:02 -08:00
Jared Boone
fe94cfa45a De-std::vector MatchedFilter, was chewing up far too much memory. 2015-11-06 09:40:02 -08:00
Jared Boone
3e9f0971e1 Assert that FSKConfiguration size is the same between application and baseband binaries. 2015-11-06 09:40:02 -08:00
Jared Boone
64ed539554 Change LinearResampler.advance to external use only. 2015-11-06 09:40:02 -08:00
Jared Boone
4ed385d15e Prioritize PacketBuilder found_end_flag() over packet_truncated(). 2015-11-06 09:40:02 -08:00
Jared Boone
c2e7f9a6f4 Shorten AIS training sequence match length. 2015-11-06 09:40:02 -08:00
Jared Boone
d92c962c0c Set MatchedFilter taps with separate method. 2015-11-06 09:40:02 -08:00
Jared Boone
8198db768d Move some MatchedFilter code to .cpp file. 2015-11-06 09:40:02 -08:00
Jared Boone
aff7865c61 Move (some) AIS bits to a separate file. 2015-11-06 09:40:02 -08:00
Jared Boone
7a5100baf1 Enlarge packet payload size 256 -> 1024 bits. 2015-11-06 09:40:01 -08:00
Jared Boone
68250b4d30 Expose weight() of FixedErrorFilter. 2015-11-06 09:40:01 -08:00
Jared Boone
474eaa8541 Template ClockRecovery for ErrorFilter type. 2015-11-06 09:40:01 -08:00
Jared Boone
9879af37d5 FixedErrorFilter constructor. 2015-11-06 09:40:01 -08:00
Jared Boone
727d4c8a1f Const the FixedErrorFilter operator(). 2015-11-06 09:40:01 -08:00
Jared Boone
93b9b9d9ef LinearErrorFilter constructor. 2015-11-06 09:40:01 -08:00
Jared Boone
57db6a6367 Ignore more initial bits of AIS training sequence. 2015-11-06 09:40:01 -08:00
Jared Boone
37b1d7cf2f Remove payload_length from PacketBuilder, etc. 2015-11-06 09:40:01 -08:00
Jared Boone
142617ad94 Silence Clang warning. 2015-11-06 09:40:01 -08:00
Jared Boone
cf3bff3b03 Decouple PacketBuilder PayloadHandler function from method type. 2015-11-06 09:40:01 -08:00
Jared Boone
1bdad62496 Simplify PacketBuilder pattern matching and symbol accumulation. 2015-11-06 09:40:00 -08:00
Jared Boone
36689f5c45 Refactor bit pattern matching.
Remove AccessCodeCorrelator, Unstuff classes.
2015-11-06 09:40:00 -08:00
Jared Boone
f918a774b7 Address implicit cast compiler warnings. 2015-11-06 09:40:00 -08:00
Jared Boone
0bc8f551de Use matched filter for AIS GMSK demodulation demo.
Less than optimal for plain FSK, but flexible enough to also support GFSK/GMSK. Not at all optimized for SIMD instructions, so may not perform adequately at Bluetooth/GSM rates.
2015-11-06 09:40:00 -08:00
Jared Boone
a9c190b6bb Matched filter implementation.
Essentially a complex FIR filter that's more flexible than the ones already in the code base. Refactor?!
2015-11-06 09:40:00 -08:00
Jared Boone
6499de39bf Shorten AIS packet to expected data + FCS length. 2015-11-06 09:40:00 -08:00
Jared Boone
bd76f0e13b Note to try different -mcpu= for LPC43xx Cortex-M0. 2015-11-06 09:40:00 -08:00
Jared Boone
e9f28f9ef3 Provide configuration of symbol unstuffing. 2015-11-06 09:40:00 -08:00
Jared Boone
a00fcbaa8f Unstuffing pattern length of zero should never match. 2015-11-06 09:40:00 -08:00
Jared Boone
05badaddda Put symbol coding into PacketBuilder.
Removes stuffing symbols before placing them into packet buffer.
2015-11-06 09:40:00 -08:00
Jared Boone
c936e09702 Add bit unstuffing algorithm.
For use in AIS. Probably useful elsewhere, too...
2015-11-06 09:39:59 -08:00
Jared Boone
31ff13f1c0 Un-const Message in message handler interfaces.
I want to modify in place the messages that are received. Naughty, but oh well.
2015-11-06 09:39:59 -08:00
Jared Boone
5469a3a31d Get ui::Console to a working state. 2015-11-06 09:39:59 -08:00
Jared Boone
5c31e803c8 Change interface to AccessCodeCorrelator, inline in header. 2015-11-06 09:39:59 -08:00
Jared Boone
a3cce5632e Complete rewrite of clock recovery, lots of refactoring. 2015-11-06 09:39:59 -08:00
Jared Boone
8b2e75a299 Add LinearResampler implementation for clock recovery. 2015-11-06 09:39:59 -08:00
Jared Boone
f13e2d32c0 Add symbol coding namespace, NRZI decoder. 2015-11-06 09:39:59 -08:00
Jared Boone
934936d3f6 Enhancements to clock recovery
Linearly interpolate input and delayed samples, based on phase of internal symbol clock.
2015-11-06 09:39:59 -08:00
Jared Boone
b41ff962f4 Replace std::sin() with interpolated LUT. 2015-10-14 11:10:24 -07:00
Jared Boone
291de8f869 Change channel_spectrum type to std::complex<float>.
Move FFT bit-reversal to complex<int16_t> -> complex<float> copy.
Change window so that adjacent bins have constant(-ish) gain.
Change window to float.
Change time domain samples to accumulate at even intervals over the FFT interval.
2015-10-14 11:10:24 -07:00