# carbonwg-pic issues and TODO list

/////////////////
TODO (critical features):
/////////////////
- implementation of sequence numbers is incomplete

- enable memory resident scripts [...data memory is getting tight]

- complete/test cal cycle logic implementation

- add support for computing *raw* CO2/H2O area

- baseline record may need to include celltemp,cellpres,h20,co2raw,co2ref (which of min/max/mean/sdev?)

- host side logic

- refine operating modes (polled/scheduled, logging)

- add sampling stats support (cycles, time drift, error counts)

- error/syslog reporting (CLI, internal API)

Features (non-critical, proposed):

- make expression parsing more flexible, to accommodate
broader range of expressions. [would be useful to permit if[var%var==0]... to periodic/modulo action using counter]

- implement call/return, subroutines

- implement concurrency features, i.e. primitive mutex

- repackage base as "femto shell (fsh)". Add serial IO generalizations? Refine API
to partition application-specific built-ins (e.g. licor): cmd function registration, peripheral selection, headers, etc.
Characterize resource footprint (256 flash, 16k RAM) - can we run on PIC16, MSP430?

- create IO wrappers for workstation build/test

- add support for SPI flash

- move registers to script context (or add a few)?

/////////////////
Bugs (pending):
/////////////////


- sdcard corruption: 18apr19-1140 : sent program to hardware via mplabx while a script was running. During subsequent reboot, the bootscript failed to load. ls indicated that files appeared to be missing, and there were several directory entries named

	DRHSA 1980/00/00 00:00 4294967295  ????????.???

	Removing SD card and mounting on mac w/ USB card reader made some of the files visible again. The strange directory entries were not visible on mac, but appeared after mounting the disk on cwg hardware (not clear how to remove them).

Used mac diskutil, ran first aid, but bad directories persist.
Saved files from SD card, reformatted using diskutil Erase (MS-DOS), then copied files back; everything looks ok.

/////////////////
DONE:
/////////////////
- OK : host interface : sample queue

- OK : implement pulsed valves if needed

- OK : do command tokenization at higher level, pass tokens (argc, argv)
to cmd funcs (exploratory code in hidden/parser). Support quoted string constants.

- OK : make log queue generic (i.e. functions pass in queue pointers)
possibly separate in to separate module. Also, could use dynamic/pooled element storage [don't strictly need these changes for CWG, since only one queue is needed]

- OK : add cycle context info record field (e.g. Span, Zero, Air, Cal...)
