David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
Diff: logger.cpp
- Revision:
- 37:23000a47ed2b
- Child:
- 46:f11cb4f93aac
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/logger.cpp Thu Mar 06 05:11:46 2014 +0000 @@ -0,0 +1,42 @@ +#pragma once + +#include "logger.h" +#include "main.h" +#include "pc_serial.h" + +Logger::Logger() +{ + entryIndex = 0; +} + +bool Logger::isFull() +{ + return entryIndex >= LOGGER_SIZE; +} + +void Logger::log() +{ + if (isFull()) + { + return; + } + + LogEntry * entry = &entries[entryIndex]; + entryIndex++; + + //entry->cos = reckoner.cos >> 16; + //entry->sin = reckoner.sin >> 16; + entry->x = reckoner.x >> 16; + entry->y = reckoner.y >> 16; +} + +void Logger::dump() +{ + pc.printf("Log dump start\r\n"); + for(int32_t i = 0; i < entryIndex; i++) + { + LogEntry * entry = &entries[i]; + pc.printf("%d,%d\r\n", entry->x, entry->y); + } + pc.printf("Log dump end\r\n"); +} \ No newline at end of file