Open leewujung opened 6 years ago
I started to work on this because it incidentally made implementing multi-channel file writing easier.
Consider using git submodule since ArduinoRingBuffer is on GitHub also. This is cleaner and helps with long-term maintenance.
Also I think in general if you download code/files directly from somewhere it's better to make them in separate folders so that it is explicit and easier to track and maintain. It's probably more convenient to go with what you have for now so that you don't lost dependencies etc, but at some point (stage 4 maybe) it will be good to organize code from different sources to be in separate folders and as well as additions from this project.
Benchmark Performance: Testing
Attached is a document outlining areas of concern for testing and measuring performance. See also #7 (testing requirements) @funnyabc: we may need to set more concrete requirements.
~Testing Areas of Concern.pdf~ UPDATE (2018-08-08 11h30): Refer now to https://github.com/aidanjohnson/dt7816/issues/8#issuecomment-411489293
@funnyabc, here are the steps for connecting and running programs on the board (that I told you verbally) in writing. Let me know if there any unclear or faulty steps.
~Connecting to the DT7816.pdf~
UPDATE (2018-08-01 13h30): Refer now to https://github.com/aidanjohnson/dt7816/wiki/Connecting:-Operation
@funnyabc, for convenience, I've reproduced the areas of concern pdf in markdown, as well as updated to reflect changes made since then.
The following are areas of concern that should be tested. The range in brackets ‘[file.c
:start-stop]’ correspond to the lines of code in files recorder/main.c and recorder/recorder_helpers.c, which are in the directory /opt/ti-sdk-am335x-evm-07.00.00.00/example-applications-dt78xx-examples/
, that should be further inspected and tested. These areas of concern are sorted by priority. It can be assumed for now that the dependency libraries (RingBuf.c
, libaiff.c
, and sunriset.c
) function properly. Any bugs in these programs can be addressed as is necessary; they, if any, will crop up as functions in the recorder
program are tested. These areas also apply to the version of the recorder
program as of 2018-08-08 at 10h30.
Command line interface cases, that is setting [main.c
:71-121]:
1.1. Enabled channels
chan_mask
)chan_mask
)1.2. Samples per file
samples_per_file
1.3. Clock frequency (sample rate)
clk.clk_freq
buffer_object.sample_rate
1.4. Sampling duration in days
duration_days
1.5. Number of buffers
num_buffers
1.6. Auto trigger (on by default/off)
1.7. Safety margin
safety_margin
1.8. Night cycling
1.9. Latitude
1.10. Longitude
1.11. Command line options
{s, c, d, b, t, i, m, n, p, l}
is usedgoto _exit
have expected behaviour. These error checks are:
main.c
:147-152]main.c
:158-166; recorder_helpers.c
: configTrig()
]main.c
:169-173]main.c
:176-183]main.c
:186-191]main.c
:196-204]. That is, check that the buffer dynamically allocated correctly (that is, correct size). (Note that this uses a manufacturer provided function.)main.c
:207-212]main.c
:253-257]main.c
:260-264]main.c
:268-272]main.c
:277-283]main.c
:291-342]:
a. Formatting of file [main.c
: setMetadata()
]
b. Opening of file
c. Starting of writing
d. Sampling writing [main.c
: writeBuffer()
]
e. Finishing of writing
f. Closing of fileCheck that ‘Ctrl+C’ aborts the program at any and all stages. awake at night and asleep during day.
Circular buffer (RingBuf.c
implementation) [recorder_helpers.c
: writeBuffer()
]; check that:
RingBuf.c
)samples_per_chan * num_buffs * num_channels > 65536
samples, fatal error occurs [recorder_helpers.c
: checkFatal()
]Day/night (asleep/awake) on/off cycling [main.c
:226-247]:
recorder_helpers.h
:90]sunset-safety_margin
) through
(sunrise+safety_margin
) [recorder_helpers.c
: calcSunUpDown()
]sunset-safety_margin
) through
(sunrise+safety_margin
) [recorder_helpers.h
: calcSunUpDown()
]main.c
:346]Miscellaneous recorder_helpers.c
functions, check that:
ledIndicators()
: If status is 1 & streaming is 1 -> LEDs on (a digital output)getTime()
: pres_time
is equal to time gotten by testing file (within some margin of
error)getTimeEpoch()
: GMT Unix epoch time returned equal to time gotten (within some margin
of error)timestamp()
: String is uniquegetPresentTime()
: Same as for getTime()
createChanMask()
: Created channel mask chan_mask
same as that returned by
IOCTL_CHAN_GET
configChan()
: All channels are configuredinitTrig()
: All triggers are configuredcalcSunUpDown()
: Calculated times same as pre-calculated and known times writeBuffer()
:
checkID()
: Any arbitrary, non-zero length string successful as IDcheckRate()
: Any arbitrary, positive, non-zero float successful as sampling frequencyopenStream()
: Confirm that opening a real stream is successful, and that opening a
bogus stream is a failureopenAIN()
: Given above, confirm that opening a real analog input is successful, and
that opening a bogus analog input is a failurewaitBuffering()
: No segmentation fault occurs after calling this function, regardless of
size of buffer and number of channelssetMetadata()
: