Store the configuration on the SD card

This commit is contained in:
2015-08-13 14:10:09 +00:00
parent 53a8072424
commit d0f9f46f9c
16 changed files with 271 additions and 26 deletions

11
log.c
View File

@@ -5,6 +5,7 @@
#include "uart.h"
#include "timer.h"
#include "log.h"
#include "config.h"
/* This is shared with sdcard.c */
bool log_enabled;
@@ -37,7 +38,9 @@ void log_put_byte(char c)
* Better than overrunning.
*/
if (((log_bufferend + 1) % LOG_BUFFERSIZE) == log_bufferstart) {
#if 0
putstr("^");
#endif
return;
}
log_buffer[log_bufferend++] = c;
@@ -70,6 +73,14 @@ void log_put_header(unsigned int timestamp)
log_put_uint(log_read_busytime());
}
void log_put_config(void)
{
log_put_uint(LOG_MAGIC_CONFIG);
log_put_uint(CONFIG_VERSION);
log_put_uint(sizeof(struct config));
log_put_array((char *)&config, sizeof(struct config));
}
void log_put_array(char *data, int length)
{
int i;