Browse Source

Removed Debug build

Thomas Buck 12 years ago
parent
commit
9bbafc0332

+ 0
- 3
CubeFirmware/audio.c View File

26
 
26
 
27
 #include "twi.h"
27
 #include "twi.h"
28
 #include "audio.h"
28
 #include "audio.h"
29
-#ifdef DEBUG
30
-#include "serial.h"
31
-#endif
32
 
29
 
33
 uint8_t ret[7]; // Buffer for data
30
 uint8_t ret[7]; // Buffer for data
34
 
31
 

+ 1
- 3
CubeFirmware/buffhelp.c View File

30
 	uint8_t i;
30
 	uint8_t i;
31
 	uint8_t *tmp = (uint8_t *)malloc(64);
31
 	uint8_t *tmp = (uint8_t *)malloc(64);
32
 	if (tmp == NULL) {
32
 	if (tmp == NULL) {
33
-#ifdef DEBUG
34
-		serialWriteString(getString(24));
35
-#endif
33
+		serialWriteString(getString(24)); // Display warning, don't care for CubeControl
36
 		while(1); // Ran out of heap => Watchdog Reset
34
 		while(1); // Ran out of heap => Watchdog Reset
37
 	}
35
 	}
38
 	for (i = 0; i < 64; i++) {
36
 	for (i = 0; i < 64; i++) {

+ 0
- 7
CubeFirmware/cube.c View File

26
 #include <stdlib.h>
26
 #include <stdlib.h>
27
 #include <util/atomic.h>
27
 #include <util/atomic.h>
28
 
28
 
29
-#ifdef DEBUG
30
-#include "serial.h"
31
-#include "strings.h"
32
-#endif
33
 #include "cube.h"
29
 #include "cube.h"
34
 
30
 
35
 #ifndef F_CPU
31
 #ifndef F_CPU
161
 				toggleFlag = COUNT2; // Ensure next interrupts starts displaying
157
 				toggleFlag = COUNT2; // Ensure next interrupts starts displaying
162
 			}
158
 			}
163
 			while(imgFlag < 1); // Wait for frame to display
159
 			while(imgFlag < 1); // Wait for frame to display
164
-			/* ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
165
-				imgBuffer[x][y] |= (0xFF); // Clear pixel
166
-			} */
167
 		}
160
 		}
168
 	}
161
 	}
169
 
162
 

+ 0
- 3
CubeFirmware/header/cube.h View File

35
 
35
 
36
 extern void fillBuffer(uint8_t val);
36
 extern void fillBuffer(uint8_t val);
37
 
37
 
38
-// For debugging, not normal operation:
39
-extern void setFet(uint8_t data);
40
-extern void setLatch(uint8_t latchNr, uint8_t data);
41
 extern uint32_t getTriggerCount(void);
38
 extern uint32_t getTriggerCount(void);

+ 1
- 4
CubeFirmware/header/transmit.h View File

23
 
23
 
24
 void recieveAnimations(void);
24
 void recieveAnimations(void);
25
 void transmitAnimations(void);
25
 void transmitAnimations(void);
26
-
27
-#ifdef DEBUG
28
-void sendAudioData(void);
29
-#endif
26
+void sendAudioData(void);

+ 6
- 61
CubeFirmware/main.c View File

63
 
63
 
64
 void serialHandler(char c);
64
 void serialHandler(char c);
65
 uint8_t audioModeSelected(void);
65
 uint8_t audioModeSelected(void);
66
-#ifdef DEBUG
67
 void printErrors(uint8_t e);
66
 void printErrors(uint8_t e);
68
 uint8_t selfTest(void);
67
 uint8_t selfTest(void);
69
 void printTime(void);
68
 void printTime(void);
70
 
69
 
71
-#include "snake.c"
72
-#endif
70
+// #include "snake.c"
73
 
71
 
74
 uint8_t shouldRestart = 0;
72
 uint8_t shouldRestart = 0;
75
 uint8_t refreshAnimationCount = 1;
73
 uint8_t refreshAnimationCount = 1;
76
 uint8_t lastButtonState = 0;
74
 uint8_t lastButtonState = 0;
77
 uint8_t maxButtonState = 0;
75
 uint8_t maxButtonState = 0;
78
-uint8_t mcusr_mirror;
79
 char buffer[11];
76
 char buffer[11];
80
 
77
 
81
 #include "builtInFrames.c"
78
 #include "builtInFrames.c"
90
 	uint16_t count;
87
 	uint16_t count;
91
 	uint64_t lastChecked;
88
 	uint64_t lastChecked;
92
 	uint8_t idleCounter = 0;
89
 	uint8_t idleCounter = 0;
93
-#ifdef DEBUG
94
 	uint32_t temp;
90
 	uint32_t temp;
95
-#endif
96
 
91
 
97
-	mcusr_mirror = MCUCSR;
98
 	MCUCSR = 0;
92
 	MCUCSR = 0;
99
 	wdt_disable();
93
 	wdt_disable();
100
 
94
 
113
 
107
 
114
 	wdt_enable(WDTO_1S); // Watchdog reset after 1 second
108
 	wdt_enable(WDTO_1S); // Watchdog reset after 1 second
115
 
109
 
116
-#ifdef DEBUG
117
-	// Kill animation counter in debug mode
118
-	// => Don't preserve animations while power down
119
-	setAnimationCount(0);
120
-
121
-	serialWriteString(getString(2));
110
+	serialWriteString(getString(2)); // "Initialized: "
122
 
111
 
123
 	i = selfTest();
112
 	i = selfTest();
124
 	if (i) {
113
 	if (i) {
125
-		serialWriteString(getString(1));
114
+		serialWriteString(getString(1)); // Selftest error
126
 		serialWriteString(itoa(i, buffer, 2));
115
 		serialWriteString(itoa(i, buffer, 2));
127
 		serialWrite('\n');
116
 		serialWrite('\n');
128
 		printErrors(i);
117
 		printErrors(i);
129
 	}
118
 	}
130
 
119
 
131
-	serialWriteString(getString(0));
132
-
133
-	if (mcusr_mirror & WDRF) {
134
-		serialWriteString(getString(31));
135
-	} else if (mcusr_mirror & BORF) {
136
-		serialWriteString(getString(32));
137
-	} else if (mcusr_mirror & EXTRF) {
138
-		serialWriteString(getString(34));
139
-	} else if (mcusr_mirror & JTRF) {
140
-		serialWriteString(getString(35));
141
-	} else if (mcusr_mirror & PORF) {
142
-		serialWriteString(getString(36));
143
-	} else {
144
-		serialWriteString(getString(33));
145
-	}
146
-#endif
120
+	serialWriteString(getString(0)); // Version
147
 
121
 
148
 	maxButtonState = numberOfVisualizations() + 1; // All visualizations and anim mode
122
 	maxButtonState = numberOfVisualizations() + 1; // All visualizations and anim mode
149
 
123
 
219
 			serialHandler((char)(serialGet()));
193
 			serialHandler((char)(serialGet()));
220
 		}
194
 		}
221
 
195
 
222
-#ifdef DEBUG
223
-		// Print frames per second
196
+		// Print fps after one second
224
 		if ((getSystemTime() >= 1000) && ((DebugDone & 1) == 0)) {
197
 		if ((getSystemTime() >= 1000) && ((DebugDone & 1) == 0)) {
225
 			temp = getTriggerCount();
198
 			temp = getTriggerCount();
226
 			serialWriteString(ltoa(temp, buffer, 10));
199
 			serialWriteString(ltoa(temp, buffer, 10));
229
 			serialWriteString(getString(28));
202
 			serialWriteString(getString(28));
230
 			DebugDone |= 1;
203
 			DebugDone |= 1;
231
 		}
204
 		}
232
-#endif
233
 
205
 
234
 		if ((getSystemTime() - lastChecked) > 150) { // Check button state every 150ms
206
 		if ((getSystemTime() - lastChecked) > 150) { // Check button state every 150ms
235
 			audioModeSelected();
207
 			audioModeSelected();
252
 			lastButtonState = 0;
224
 			lastButtonState = 0;
253
 		}
225
 		}
254
 
226
 
255
-#ifdef DEBUG
256
-		if (lastButtonState) {
257
-			serialWriteString(getString(38));
258
-		} else {
259
-			serialWriteString(getString(39));
260
-		}
261
-#endif
262
-
263
 	}
227
 	}
264
 	return lastButtonState;
228
 	return lastButtonState;
265
 }
229
 }
266
 
230
 
267
-#ifdef DEBUG
268
 uint8_t selfTest(void) {
231
 uint8_t selfTest(void) {
269
 	uint8_t result = NOERROR;
232
 	uint8_t result = NOERROR;
270
 	
233
 	
329
 	}
292
 	}
330
 	free(b);
293
 	free(b);
331
 }
294
 }
332
-#endif
333
 
295
 
334
 void serialHandler(char c) {
296
 void serialHandler(char c) {
335
 	// Used letters:
297
 	// Used letters:
336
 	// a, b, c, d, e, g, i, n, q, r, s, t, v, x, y, 0, 1, 2, 3, #
298
 	// a, b, c, d, e, g, i, n, q, r, s, t, v, x, y, 0, 1, 2, 3, #
337
-#ifdef DEBUG
338
 	uint8_t i, y, z;
299
 	uint8_t i, y, z;
339
-	serialWrite(c);
340
-	serialWriteString(": ");
341
-#endif
342
 
300
 
343
 	switch(c) {
301
 	switch(c) {
344
 	case OK:
302
 	case OK:
347
 
305
 
348
 	case 'h': case 'H': case '?':
306
 	case 'h': case 'H': case '?':
349
 		serialWriteString(getString(6));
307
 		serialWriteString(getString(6));
350
-#ifdef DEBUG
351
 		serialWriteString(getString(7));
308
 		serialWriteString(getString(7));
352
 		serialWriteString(getString(8));
309
 		serialWriteString(getString(8));
353
 		serialWriteString(getString(9));
310
 		serialWriteString(getString(9));
356
 		serialWriteString(getString(12));
313
 		serialWriteString(getString(12));
357
 		serialWriteString(getString(13));
314
 		serialWriteString(getString(13));
358
 		serialWriteString(getString(26));
315
 		serialWriteString(getString(26));
359
-#endif
360
 		break;
316
 		break;
361
 
317
 
362
 	case 'd': case 'D':
318
 	case 'd': case 'D':
363
 		clearMem();
319
 		clearMem();
364
-#ifndef DEBUG
365
 		serialWrite(OK);
320
 		serialWrite(OK);
366
-#endif
367
-#ifdef DEBUG
368
-		serialWriteString(getString(29));
369
-#endif
370
 		break;
321
 		break;
371
 
322
 
372
-#ifndef DEBUG
373
 	case 'g': case 'G':
323
 	case 'g': case 'G':
374
 		transmitAnimations();
324
 		transmitAnimations();
375
 		break;
325
 		break;
377
 	case 's': case 'S':
327
 	case 's': case 'S':
378
 		recieveAnimations();
328
 		recieveAnimations();
379
 		break;
329
 		break;
380
-#endif
381
 
330
 
382
 	case 'v': case 'V':
331
 	case 'v': case 'V':
383
 		serialWriteString(getString(0));
332
 		serialWriteString(getString(0));
384
 		break;
333
 		break;
385
 
334
 
386
-#ifdef DEBUG
387
 	case 'm': case 'M':
335
 	case 'm': case 'M':
388
 		lastButtonState = !lastButtonState;
336
 		lastButtonState = !lastButtonState;
389
 		if (lastButtonState) {
337
 		if (lastButtonState) {
439
 		break;
387
 		break;
440
 
388
 
441
 	case 'n': case 'N':
389
 	case 'n': case 'N':
442
-		snake();
390
+		// snake();
443
 		break;
391
 		break;
444
 
392
 
445
 	case '0':
393
 	case '0':
492
 		serialWriteString(ltoa(getTriggerCount(), buffer, 10));
440
 		serialWriteString(ltoa(getTriggerCount(), buffer, 10));
493
 		serialWrite('\n');
441
 		serialWrite('\n');
494
 		break;
442
 		break;
495
-#endif
496
 
443
 
497
 	default:
444
 	default:
498
 		serialWrite(ERROR);
445
 		serialWrite(ERROR);
501
 	// c was used as temp var and does not contain the char anymore...!
448
 	// c was used as temp var and does not contain the char anymore...!
502
 }
449
 }
503
 
450
 
504
-#ifdef DEBUG
505
 void printTime(void) {
451
 void printTime(void) {
506
 	serialWriteString(getString(14));
452
 	serialWriteString(getString(14));
507
 	serialWriteString(ltoa(getSystemTime(), buffer, 10));
453
 	serialWriteString(ltoa(getSystemTime(), buffer, 10));
528
 		serialWrite('\n');
474
 		serialWrite('\n');
529
 	}
475
 	}
530
 }
476
 }
531
-#endif

+ 1291
- 755
CubeFirmware/main.hex
File diff suppressed because it is too large
View File


+ 0
- 4
CubeFirmware/mem.c View File

26
 #include <stdint.h>
26
 #include <stdint.h>
27
 #include "twi.h"
27
 #include "twi.h"
28
 #include "mem.h"
28
 #include "mem.h"
29
-#ifdef DEBUG
30
 #include "serial.h"
29
 #include "serial.h"
31
 #include "strings.h"
30
 #include "strings.h"
32
-#endif
33
 
31
 
34
 // address is a number between (inclusive) zero and 131071
32
 // address is a number between (inclusive) zero and 131071
35
 uint8_t memGetByte(uint32_t address) {
33
 uint8_t memGetByte(uint32_t address) {
65
 	addB = address & 0xFF;
63
 	addB = address & 0xFF;
66
 	ret = (uint8_t *)malloc(length); // Allocate memory for values read
64
 	ret = (uint8_t *)malloc(length); // Allocate memory for values read
67
 	if (ret == NULL) {
65
 	if (ret == NULL) {
68
-#ifdef DEBUG
69
 		serialWriteString(getString(24));
66
 		serialWriteString(getString(24));
70
-#endif
71
 		return NULL;
67
 		return NULL;
72
 	}
68
 	}
73
 
69
 

+ 9
- 14
CubeFirmware/strings.c View File

24
 
24
 
25
 char buffer[60];
25
 char buffer[60];
26
 
26
 
27
-#ifdef DEBUG
28
-const char stringVersion[] PROGMEM = "v2.3 Debug Build\nPROBABLY NOT COMPATIBLE WITH CubeControl Software!\n"; // 0
29
-#else
30
-const char stringVersion[] PROGMEM = "v2.3 Release\n"; // 0
31
-#endif
32
-
27
+const char stringVersion[] PROGMEM = "v2.4\n"; // 0
33
 const char stringSelfTestError[] PROGMEM = "Self-Test Error: 0b"; // 1
28
 const char stringSelfTestError[] PROGMEM = "Self-Test Error: 0b"; // 1
34
 const char stringInit[] PROGMEM = "Initialized: "; // 2
29
 const char stringInit[] PROGMEM = "Initialized: "; // 2
35
 const char stringAudioError[] PROGMEM = " => No answer from Audio!\n"; // 3
30
 const char stringAudioError[] PROGMEM = " => No answer from Audio!\n"; // 3
60
 const char stringFrames2[] PROGMEM = " Frames per Second\n"; // 28
55
 const char stringFrames2[] PROGMEM = " Frames per Second\n"; // 28
61
 const char stringDeleted[] PROGMEM = "Memory deleted!\n"; // 29
56
 const char stringDeleted[] PROGMEM = "Memory deleted!\n"; // 29
62
 const char stringReset[] PROGMEM = "Reset in 500ms. Bye!\n"; // 30
57
 const char stringReset[] PROGMEM = "Reset in 500ms. Bye!\n"; // 30
63
-const char stringWatchdog[] PROGMEM = "Watchdog Reset detected.\n"; // 31
64
-const char stringBrownout[] PROGMEM = "Brown-Out Reset detected.\n"; // 32
65
-const char stringNothing[] PROGMEM = "No Reset reason detected.\n"; // 33
66
-const char stringExtern[] PROGMEM = "External Reset detected.\n"; // 34
67
-const char stringJtag[] PROGMEM = "JTAG Reset detected.\n"; // 35
68
-const char stringPowerOn[] PROGMEM = "Power-On Reset detected.\n"; // 36
58
+const char stringWatchdog[] PROGMEM = ""; // 31
59
+const char stringBrownout[] PROGMEM = ""; // 32
60
+const char stringNothing[] PROGMEM = ""; // 33
61
+const char stringExtern[] PROGMEM = ""; // 34
62
+const char stringJtag[] PROGMEM = ""; // 35
63
+const char stringPowerOn[] PROGMEM = ""; // 36
69
 const char stringMinute[] PROGMEM = "Yay! Another minute passed :)\n"; // 37
64
 const char stringMinute[] PROGMEM = "Yay! Another minute passed :)\n"; // 37
70
-const char stringAudioMode[] PROGMEM = "Audio Mode!\n"; // 38
71
-const char stringCubeMode[] PROGMEM = "Cube Mode!\n"; // 39
65
+const char stringAudioMode[] PROGMEM = ""; // 38
66
+const char stringCubeMode[] PROGMEM = ""; // 39
72
 const char stringModeChange[] PROGMEM = "Cube mode entered!\n"; // 40
67
 const char stringModeChange[] PROGMEM = "Cube mode entered!\n"; // 40
73
 const char stringModeChange2[] PROGMEM = "Audio mode entered!\n"; // 41
68
 const char stringModeChange2[] PROGMEM = "Audio mode entered!\n"; // 41
74
 
69
 

+ 1
- 2
README.md View File

8
 
8
 
9
 ## Firmware
9
 ## Firmware
10
 
10
 
11
-The firmware of the Controller is yet to be tested...
12
-It uses [Peter Fleury's TWI Library](http://homepage.hispeed.ch/peterfleury/avr-software.html).
11
+2 Firmwares, for the AtMega8 TWI Slave and for the Atmega32. Currently in development.
13
 
12
 
14
 ## Cube Control
13
 ## Cube Control
15
 
14
 

Loading…
Cancel
Save