diff --git a/docs/CHANGELOG.md b/docs/CHANGES.md similarity index 100% rename from docs/CHANGELOG.md rename to docs/CHANGES.md diff --git a/docs/LICENSE.md b/docs/LICENSE.md new file mode 100644 index 0000000..0febbf8 --- /dev/null +++ b/docs/LICENSE.md @@ -0,0 +1,26 @@ +## License + +All Rights Reserved + +Copyright (c) 2024 Madcow Software +Copyright (c) 2024 Carlos Krieg + +THE CONTENTS OF THIS PROJECT ARE PROPRIETARY AND CONFIDENTIAL. +UNAUTHORIZED COPYING, TRANSFERRING OR REPRODUCTION OF THE +CONTENTS OF THIS PROJECT, VIA ANY MEDIUM IS STRICTLY PROHIBITED. + +The receipt or possession of the source code and/or any parts +thereof does not convey or imply any right to use them for any +purpose other than the purpose for which they were provided to you. + +The software is provided "AS IS", without warranty of any kind, +express or implied, including but not limited to the warranties of +merchantability, fitness for a particular purpose and non +infringement. In no event shall the authors or copyright holders +be liable for any claim, damages or other liability, whether in an +action of contract, tort or otherwise, arising from, out of or in +connection with the software or the use or other dealings in the +software. + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the software. diff --git a/docs/README.md b/docs/README.md index 4550210..6b6b659 100644 --- a/docs/README.md +++ b/docs/README.md @@ -31,24 +31,24 @@ Makefile for all build settings and make sure they are correct for your current environment. To remove build-related auxiliary files you may use one -of these commands: +of these commands, with varying levels of cleanliness: make clean make distclean -Isolated unit tests allow you to verify all testable -components are behaving as expected. Please note that most -tests will be added later down the road, when the project -has reached a more mature state. There is also support for -testing on simulated hardware if you have +Isolated unit tests allow you to verify all source modules +are behaving as expected. Please note that most tests will +be added later down the road, when the project has reached +a more mature state. There is also support for running the +binaries on simulated hardware if you have [simavr](https://github.com/buserror/simavr) installed. make check make simulate -You can listen on the serial debug interface by running -the command below. This will also initialize all optional -submodules on first invocation. +You can listen on the serial debug interface by executing +the command below. Optional submodules will be initialized +on first invocation since they contain the necessary tools. make listen diff --git a/docs/TODO.md b/docs/TODO.md new file mode 100644 index 0000000..6122dfc --- /dev/null +++ b/docs/TODO.md @@ -0,0 +1,23 @@ +## Current Tasks + +- Test stability with 18.432 MHz external oscillator. +- Implement state machine for actual drying operation. +- Rewrite code documentation with proper structure. +- Check sensor measurements, conversion results and timer output frequencies. +- Implement custom bootloader to facilitate software updates over serial port. +- Make sure the initialization sequence can recover from as many technical +problems as possible. +- Implement I2C timeout or failing components may cause watchdog reset loop. +- Detect brown-out and external resets during the initialization sequence. +- Write isolated unit tests either with mocks or running in simulation. +- Write simulated I2C components for more realistic testing with simavr. +- MOSFET module needlessly specific? Rewrite as generic digital output? +- Handle more parser commands like UPDATE, START and STOP. +- Implement parser timeout for large input. Otherwise an UART RX buffer overflow +will swallow the line terminator leading to the next command not getting parsed +correctly. Also check for possible edge cases when the UART and parser buffers +have different sizes. +- Force system reset in Error() function? +- Test efficiency for I2C via interrupts and ADS1115 continous mode. +- Write cross-platform configuration header for different microchips? +- Refactoring and optimization after all v1.0 features are finalized. diff --git a/src/bus/i2c.c b/src/bus/i2c.c index 9e76913..88b2249 100644 --- a/src/bus/i2c.c +++ b/src/bus/i2c.c @@ -14,12 +14,6 @@ #define TW_MR_SLA_NACK 0x48 // SLA+R transmitted, NACK received #define TW_MR_DATA_ACK 0x50 // Data received, ACK returned -// TODO: Error handling and recovery besides watchdog timer. -// TODO: Add more documentation from the atmel data sheet. -// TODO: ADS1115 continuous mode instead of single-shot? -// TODO: Implement TWI_vect ISR? This may not actually be -// much better than the blocking approach. - static void I2C_AHT20_Reset(void); static bool I2C_AHT20_IsCalibrated(void); static void I2C_AHT20_Calibrate(void); diff --git a/src/bus/pwm.c b/src/bus/pwm.c index fa77bba..5a8b0af 100644 --- a/src/bus/pwm.c +++ b/src/bus/pwm.c @@ -1,8 +1,6 @@ #include "common.h" #include "bus/pwm.h" -// TODO: Add documentation for timer3: TCCR3A, TCCR3B, etc. - int PWM_Init(void) { // PD4: PWM NF-12 Fan Peltier Hot Side @@ -102,7 +100,6 @@ void PWM_SetValue(int port, int value) if (port != FAN01 && port != FAN02 && port != FAN03) return; // Invalid port - // Workaround: Missing third 16-bit timer output n = CLAMP(value, 100, 0) * PWM_CYCLE_TOP / 100.0f; Info("Setting duty cycle for %s to %d/%d...", diff --git a/src/common/parser.c b/src/common/parser.c index 3202817..7d8cc95 100644 --- a/src/common/parser.c +++ b/src/common/parser.c @@ -6,11 +6,6 @@ #define CMD_MAX_LEN 128 -// TODO: Write documentation. -// TODO: Reset command buffer on timeout. -// TODO: Test with different RXBUF sizes. -// TODO: Add commands update, start and stop. - static char cmdbuf[CMD_MAX_LEN + 1]; static char *tail = cmdbuf + CMD_MAX_LEN; static char *head = cmdbuf; diff --git a/src/main.c b/src/main.c index 1c61d3d..b572f0c 100644 --- a/src/main.c +++ b/src/main.c @@ -6,17 +6,6 @@ #include -// TODO: Facilitate software updates over serial port. -// TODO: Check parser and circular buffer for edge cases. -// TODO: Implement command parser timeout for large input. -// TODO: Config header for chip specifics like EEPROM size. -// TODO: Check thermistor conversion results /w thermometer. -// TODO: Implement primary state machine for update loop. -// TODO: Use 18.432MHz quarz crystal, burn required fuses. -// TODO: Implement optional CRC8 sensor measurement check. -// TODO: Proper error handling and recovery (after testing). -// TODO: Check why the MCUCSR EXTRF reset flag is set. - enum state_e { S_IDLE,