Browse Source

Removed Debug build

Thomas Buck 12 years ago
parent
commit
9bbafc0332

+ 0
- 3
CubeFirmware/audio.c View File

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

+ 1
- 3
CubeFirmware/buffhelp.c View File

@@ -30,9 +30,7 @@ uint8_t *buffNew(void) {
30 30
 	uint8_t i;
31 31
 	uint8_t *tmp = (uint8_t *)malloc(64);
32 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 34
 		while(1); // Ran out of heap => Watchdog Reset
37 35
 	}
38 36
 	for (i = 0; i < 64; i++) {

+ 0
- 7
CubeFirmware/cube.c View File

@@ -26,10 +26,6 @@
26 26
 #include <stdlib.h>
27 27
 #include <util/atomic.h>
28 28
 
29
-#ifdef DEBUG
30
-#include "serial.h"
31
-#include "strings.h"
32
-#endif
33 29
 #include "cube.h"
34 30
 
35 31
 #ifndef F_CPU
@@ -161,9 +157,6 @@ void initCube(void) {
161 157
 				toggleFlag = COUNT2; // Ensure next interrupts starts displaying
162 158
 			}
163 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,7 +35,4 @@ extern void close(void);
35 35
 
36 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 38
 extern uint32_t getTriggerCount(void);

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

@@ -23,7 +23,4 @@
23 23
 
24 24
 void recieveAnimations(void);
25 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,19 +63,16 @@
63 63
 
64 64
 void serialHandler(char c);
65 65
 uint8_t audioModeSelected(void);
66
-#ifdef DEBUG
67 66
 void printErrors(uint8_t e);
68 67
 uint8_t selfTest(void);
69 68
 void printTime(void);
70 69
 
71
-#include "snake.c"
72
-#endif
70
+// #include "snake.c"
73 71
 
74 72
 uint8_t shouldRestart = 0;
75 73
 uint8_t refreshAnimationCount = 1;
76 74
 uint8_t lastButtonState = 0;
77 75
 uint8_t maxButtonState = 0;
78
-uint8_t mcusr_mirror;
79 76
 char buffer[11];
80 77
 
81 78
 #include "builtInFrames.c"
@@ -90,11 +87,8 @@ int main(void) {
90 87
 	uint16_t count;
91 88
 	uint64_t lastChecked;
92 89
 	uint8_t idleCounter = 0;
93
-#ifdef DEBUG
94 90
 	uint32_t temp;
95
-#endif
96 91
 
97
-	mcusr_mirror = MCUCSR;
98 92
 	MCUCSR = 0;
99 93
 	wdt_disable();
100 94
 
@@ -113,37 +107,17 @@ int main(void) {
113 107
 
114 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 112
 	i = selfTest();
124 113
 	if (i) {
125
-		serialWriteString(getString(1));
114
+		serialWriteString(getString(1)); // Selftest error
126 115
 		serialWriteString(itoa(i, buffer, 2));
127 116
 		serialWrite('\n');
128 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 122
 	maxButtonState = numberOfVisualizations() + 1; // All visualizations and anim mode
149 123
 
@@ -219,8 +193,7 @@ int main(void) {
219 193
 			serialHandler((char)(serialGet()));
220 194
 		}
221 195
 
222
-#ifdef DEBUG
223
-		// Print frames per second
196
+		// Print fps after one second
224 197
 		if ((getSystemTime() >= 1000) && ((DebugDone & 1) == 0)) {
225 198
 			temp = getTriggerCount();
226 199
 			serialWriteString(ltoa(temp, buffer, 10));
@@ -229,7 +202,6 @@ int main(void) {
229 202
 			serialWriteString(getString(28));
230 203
 			DebugDone |= 1;
231 204
 		}
232
-#endif
233 205
 
234 206
 		if ((getSystemTime() - lastChecked) > 150) { // Check button state every 150ms
235 207
 			audioModeSelected();
@@ -252,19 +224,10 @@ uint8_t audioModeSelected(void) {
252 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 228
 	return lastButtonState;
265 229
 }
266 230
 
267
-#ifdef DEBUG
268 231
 uint8_t selfTest(void) {
269 232
 	uint8_t result = NOERROR;
270 233
 	
@@ -329,16 +292,11 @@ void randomAnimation(void) {
329 292
 	}
330 293
 	free(b);
331 294
 }
332
-#endif
333 295
 
334 296
 void serialHandler(char c) {
335 297
 	// Used letters:
336 298
 	// a, b, c, d, e, g, i, n, q, r, s, t, v, x, y, 0, 1, 2, 3, #
337
-#ifdef DEBUG
338 299
 	uint8_t i, y, z;
339
-	serialWrite(c);
340
-	serialWriteString(": ");
341
-#endif
342 300
 
343 301
 	switch(c) {
344 302
 	case OK:
@@ -347,7 +305,6 @@ void serialHandler(char c) {
347 305
 
348 306
 	case 'h': case 'H': case '?':
349 307
 		serialWriteString(getString(6));
350
-#ifdef DEBUG
351 308
 		serialWriteString(getString(7));
352 309
 		serialWriteString(getString(8));
353 310
 		serialWriteString(getString(9));
@@ -356,20 +313,13 @@ void serialHandler(char c) {
356 313
 		serialWriteString(getString(12));
357 314
 		serialWriteString(getString(13));
358 315
 		serialWriteString(getString(26));
359
-#endif
360 316
 		break;
361 317
 
362 318
 	case 'd': case 'D':
363 319
 		clearMem();
364
-#ifndef DEBUG
365 320
 		serialWrite(OK);
366
-#endif
367
-#ifdef DEBUG
368
-		serialWriteString(getString(29));
369
-#endif
370 321
 		break;
371 322
 
372
-#ifndef DEBUG
373 323
 	case 'g': case 'G':
374 324
 		transmitAnimations();
375 325
 		break;
@@ -377,13 +327,11 @@ void serialHandler(char c) {
377 327
 	case 's': case 'S':
378 328
 		recieveAnimations();
379 329
 		break;
380
-#endif
381 330
 
382 331
 	case 'v': case 'V':
383 332
 		serialWriteString(getString(0));
384 333
 		break;
385 334
 
386
-#ifdef DEBUG
387 335
 	case 'm': case 'M':
388 336
 		lastButtonState = !lastButtonState;
389 337
 		if (lastButtonState) {
@@ -439,7 +387,7 @@ void serialHandler(char c) {
439 387
 		break;
440 388
 
441 389
 	case 'n': case 'N':
442
-		snake();
390
+		// snake();
443 391
 		break;
444 392
 
445 393
 	case '0':
@@ -492,7 +440,6 @@ killMeForIt:
492 440
 		serialWriteString(ltoa(getTriggerCount(), buffer, 10));
493 441
 		serialWrite('\n');
494 442
 		break;
495
-#endif
496 443
 
497 444
 	default:
498 445
 		serialWrite(ERROR);
@@ -501,7 +448,6 @@ killMeForIt:
501 448
 	// c was used as temp var and does not contain the char anymore...!
502 449
 }
503 450
 
504
-#ifdef DEBUG
505 451
 void printTime(void) {
506 452
 	serialWriteString(getString(14));
507 453
 	serialWriteString(ltoa(getSystemTime(), buffer, 10));
@@ -528,4 +474,3 @@ void printTime(void) {
528 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,10 +26,8 @@
26 26
 #include <stdint.h>
27 27
 #include "twi.h"
28 28
 #include "mem.h"
29
-#ifdef DEBUG
30 29
 #include "serial.h"
31 30
 #include "strings.h"
32
-#endif
33 31
 
34 32
 // address is a number between (inclusive) zero and 131071
35 33
 uint8_t memGetByte(uint32_t address) {
@@ -65,9 +63,7 @@ uint8_t *memGetBytes(uint32_t address, uint8_t length) {
65 63
 	addB = address & 0xFF;
66 64
 	ret = (uint8_t *)malloc(length); // Allocate memory for values read
67 65
 	if (ret == NULL) {
68
-#ifdef DEBUG
69 66
 		serialWriteString(getString(24));
70
-#endif
71 67
 		return NULL;
72 68
 	}
73 69
 

+ 9
- 14
CubeFirmware/strings.c View File

@@ -24,12 +24,7 @@
24 24
 
25 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 28
 const char stringSelfTestError[] PROGMEM = "Self-Test Error: 0b"; // 1
34 29
 const char stringInit[] PROGMEM = "Initialized: "; // 2
35 30
 const char stringAudioError[] PROGMEM = " => No answer from Audio!\n"; // 3
@@ -60,15 +55,15 @@ const char stringInterrupts[] PROGMEM = " Interrupts after 1000msec\n"; // 27
60 55
 const char stringFrames2[] PROGMEM = " Frames per Second\n"; // 28
61 56
 const char stringDeleted[] PROGMEM = "Memory deleted!\n"; // 29
62 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 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 67
 const char stringModeChange[] PROGMEM = "Cube mode entered!\n"; // 40
73 68
 const char stringModeChange2[] PROGMEM = "Audio mode entered!\n"; // 41
74 69
 

+ 1
- 2
README.md View File

@@ -8,8 +8,7 @@ You can find the schematic as png and Eagle file in this directory.
8 8
 
9 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 13
 ## Cube Control
15 14
 

Loading…
Cancel
Save