Переглянути джерело

Misc fixes.

Audio CPU now resets MSGEQ7 properly. Bufferhelper clears memory after
allocation. Z Axis now goes into the correct direction. Removed
FillRect. Enabled Watchdog for Debug Build, too. Removed unneeded
strings. Built-In Framedata in own file. Makefile cleans object files
after every build, because it doesn't matter. Simple Visualization
works correctly. Most recent Hex-Files now included.
Thomas Buck 12 роки тому
джерело
коміт
14eccc53e8

+ 3
- 1
AudioFirmware/eq.c Переглянути файл

@@ -57,12 +57,14 @@ uint8_t *equalizerGet(void) {
57 57
 		PORTC |= (1 << PC2); // Strobe '1'
58 58
 		_delay_us(STROBEDELAY); // create minimal pulse width
59 59
 		PORTC &= ~(1 << PC2);
60
-		adcStartConversion(0x00);
61 60
 		_delay_us(READDELAY); // Wait for result to appear
61
+		adcStartConversion(0x00);
62 62
 		result[i] = offset + adcGetByte();
63 63
 		_delay_us(STROBEDELAY);
64 64
 	}
65 65
 
66
+	PORTC |= (1 << PC3); // Enable reset
67
+
66 68
 	return result;
67 69
 }
68 70
 

+ 3
- 4
AudioFirmware/main.c Переглянути файл

@@ -49,9 +49,9 @@ int main(void) {
49 49
 	MCUCSR = 0;
50 50
 	wdt_disable();
51 51
 
52
-	DDRB = 0x3F;
53
-	DDRC = 0x0C;
54
-	DDRD = 0xFF;
52
+	DDRB = 6;
53
+	DDRC = 12;
54
+	DDRD = 0;
55 55
 	
56 56
 	twiInit(0x42); // All TWI action happens completely in the background.
57 57
 	adcInit();
@@ -69,7 +69,6 @@ int main(void) {
69 69
 	while (1) {
70 70
 		if (twiDataWasSent()) {
71 71
 			PORTB ^= (1 << PB2); // Toggle for every transaction
72
-			
73 72
 			music = equalizerGet();
74 73
 			twiSetDataToSend(music);
75 74
 			free(music);

+ 82
- 0
AudioFirmware/main.hex Переглянути файл

@@ -0,0 +1,82 @@
1
+:1000000012C02CC02BC02AC029C028C027C026C0BF
2
+:1000100025C024C023C022C021C020C01FC01EC0D4
3
+:100020001DC0EBC01BC011241FBECFE5D4E0DEBF56
4
+:10003000CDBF10E0A0E6B0E0E6EFF4E002C005902E
5
+:100040000D92AE36B107D9F710E0AEE6B0E001C0D0
6
+:100050001D92A437B107E1F719D04BC2D1CFC29A94
7
+:10006000C19884EC99E020E931E0F9013197F1F78A
8
+:100070000197D9F7C298C19A84EC99E020E931E060
9
+:10008000F9013197F1F70197D9F70895EF92FF92AF
10
+:100090000F931F93CF93DF9314BE88E10FB6F894AC
11
+:1000A00081BD11BC0FBE86E087BB8CE084BB11BA5A
12
+:1000B00082E4F7D042D054D0D2DFD1DF2DE088E106
13
+:1000C00090E00FB6F894A89581BD0FBE21BD55D024
14
+:1000D0008C01F1D0C801B5D194E0E92E82E0F82E70
15
+:1000E000C0EADFE0F9D0882341F088B38E2588BBD1
16
+:1000F00044D08C01E0D0C801A4D188B38F2588BB3F
17
+:10010000CE010197F1F7A895EDCF97B1907F97B900
18
+:1001100097B18F70892B87B9369A089586B18295E9
19
+:100120008695869583708095817008953699FECF67
20
+:10013000369824B135B1C901089584B38C7F84BB4E
21
+:1001400017B83E9A86B1856086B9379A80E0DDDFC0
22
+:10015000EDDF0895EBDF9695879596958795089541
23
+:1001600084B38C6084BBAB9A85E08A95F1F70895DF
24
+:1001700081E0CBDFEFDF86950895BF92CF92DF92CB
25
+:10018000EF92FF920F931F93CF93DF9387E090E05E
26
+:10019000ABD0F92E182FC82EEBDFD82EAB9880E20B
27
+:1001A00091E00197F1F7812F9F2DEC0190E6E92E68
28
+:1001B00080ECB82E8E01095F1F4FAA9A8E2D8A956A
29
+:1001C000F1F7AA988B2D8A95F1F780E09EDFC2DFC8
30
+:1001D0008D0D89938E2D8A95F1F7C017D10769F798
31
+:1001E000AB9A8C2D9F2DDF91CF911F910F91FF9096
32
+:1001F000EF90DF90CF90BF9008951F920F920FB6AF
33
+:100200000F9211248F939F93EF93FF9381B190E00E
34
+:10021000887F883B9105C1F0893B91053CF4883A81
35
+:10022000910559F0803B910581F507C0803C91050F
36
+:1002300031F1883C910549F522C081E080936F003F
37
+:100240008091600083B915C090916F00963040F0A6
38
+:1002500010926F008091660083B986B78F7B11C0C2
39
+:10026000E92FF0E0E05AFF4F808183B99F5F9093C0
40
+:100270006F0086B7806486BF10926E0006C086B796
41
+:10028000806486BF81E080936E0086B7806886BFF9
42
+:10029000FF91EF919F918F910F900FBE0F901F9044
43
+:1002A0001895882311F481E001C08E7F82B985E41E
44
+:1002B00086BF78940895AC0120E030E0F901E05A5F
45
+:1002C000FF4FDA01A20FB31F8C9180832F5F3F4F46
46
+:1002D0002730310599F7089580916E00882319F031
47
+:1002E00010926E0081E00895CF93DF93BC018230BD
48
+:1002F000910510F462E070E0A0917200B09173007B
49
+:10030000ED01E0E0F0E040E050E021C0888199811B
50
+:100310008617970769F48A819B81309719F0938338
51
+:10032000828304C09093730080937200FE0134C0F6
52
+:100330006817790738F44115510519F084179507A6
53
+:1003400008F4AC01FE018A819B819C01E9012097A0
54
+:10035000E9F641155105A9F1CA01861B970B0497CF
55
+:1003600008F4BA01E0E0F0E02AC08D919C91119769
56
+:1003700084179507F9F46417750781F412968D9127
57
+:100380009C911397309719F09383828304C09093C4
58
+:10039000730080937200FD0132964FC0CA01861B24
59
+:1003A000970BFD01E80FF91F6193719302978D93ED
60
+:1003B0009C9343C0FD01828193819C01D9011097D8
61
+:1003C000A1F68091700090917100892B41F4809189
62
+:1003D000690090916A009093710080937000409141
63
+:1003E0006B0050916C004115510541F44DB75EB75B
64
+:1003F0008091670090916800481B590B2091700014
65
+:100400003091710024173507B0F4CA01821B930B99
66
+:100410008617970780F0AB014E5F5F4F84179507F3
67
+:1004200050F0420F531F5093710040937000F90138
68
+:100430006193719302C0E0E0F0E0CF01DF91CF91D2
69
+:100440000895CF93DF93009709F450C0EC012297F1
70
+:100450001B821A82A0917200B0917300109709F16B
71
+:1004600040E050E0AC17BD0708F1BB83AA83FE0152
72
+:1004700021913191E20FF31FAE17BF0779F48D91EF
73
+:100480009C911197280F391F2E5F3F4F3983288386
74
+:1004900012968D919C9113979B838A8341155105E8
75
+:1004A00071F4D0937300C093720020C012968D91A6
76
+:1004B0009C911397AD01009711F0DC01D3CFFA01A5
77
+:1004C000D383C28321913191E20FF31FCE17DF074F
78
+:1004D00069F488819981280F391F2E5F3F4FFA01F7
79
+:1004E000318320838A819B8193838283DF91CF91A3
80
+:0604F0000895F894FFCF0F
81
+:0E04F600424242424242422000740000000096
82
+:00000001FF

+ 7
- 41
CubeFirmware/buffhelp.c Переглянути файл

@@ -27,6 +27,7 @@
27 27
 #include <strings.h>
28 28
 
29 29
 uint8_t *buffNew(void) {
30
+	uint8_t i;
30 31
 	uint8_t *tmp = (uint8_t *)malloc(64);
31 32
 	if (tmp == NULL) {
32 33
 #ifdef DEBUG
@@ -34,54 +35,19 @@ uint8_t *buffNew(void) {
34 35
 #endif
35 36
 		while(1); // Ran out of heap => Watchdog Reset
36 37
 	}
38
+	for (i = 0; i < 64; i++) {
39
+		// Clear pixels
40
+		tmp[i] = 0;
41
+	}
37 42
 	return tmp;
38 43
 }
39 44
 
40 45
 void buffSetPixel(uint8_t *buffer, uint8_t x, uint8_t y, uint8_t z) {
41
-	buffer[(8 * z) + (7 - y)] |= (1 << x);
46
+	buffer[(8 * (7 - z)) + (7 - y)] |= (1 << x);
42 47
 }
43 48
 
44 49
 void buffClearPixel(uint8_t *buffer, uint8_t x, uint8_t y, uint8_t z) {
45
-	buffer[(8 * z) + (7 - y)] &= ~(1 << x);
46
-}
47
-
48
-void buffFillRect(uint8_t *buffer, uint8_t x1, uint8_t y1, uint8_t z1,
49
-					uint8_t x2, uint8_t y2, uint8_t z2, uint8_t value) {
50
-	uint8_t depth, depthMax, depthMin, x, xMax, xMin, y, yMax, yMin;
51
-
52
-	if (z1 <= z2) {
53
-		depthMin = z1;
54
-		depthMax = z2;
55
-	} else {
56
-		depthMin = z2;
57
-		depthMax = z1;
58
-	}
59
-	if (x1 <= x2) {
60
-		xMin = x1;
61
-		xMax = x2;
62
-	} else {
63
-		xMin = x2;
64
-		xMax = x1;
65
-	}
66
-	if (y1 <= y2) {
67
-		yMin = y1;
68
-		yMax = y2;
69
-	} else {
70
-		yMin = y2;
71
-		yMax = y1;
72
-	}
73
-	for (depth = depthMin; depth <= depthMax; depth++) {
74
-		// now draw a 2d rectangle, z = depth
75
-		for (x = xMin; x <= xMax; x++) {
76
-			for (y = yMin; y <= yMax; y++) {
77
-				if (value) {
78
-					buffSetPixel(buffer, x, y, depth);
79
-				} else {
80
-					buffClearPixel(buffer, x, y, depth);
81
-				}
82
-			}
83
-		}
84
-	}
50
+	buffer[(8 * (7 - z)) + (7 - y)] &= ~(1 << x);
85 51
 }
86 52
 
87 53
 void buffFree(uint8_t *buffer) {

+ 64
- 0
CubeFirmware/builtInFrames.c Переглянути файл

@@ -0,0 +1,64 @@
1
+/*
2
+ * builtInFrames.c
3
+ *
4
+ * Copyright 2011 Thomas Buck <xythobuz@me.com>
5
+ * Copyright 2011 Max Nuding <max.nuding@gmail.com>
6
+ * Copyright 2011 Felix Bäder <baeder.felix@gmail.com>
7
+ *
8
+ * This file is part of LED-Cube.
9
+ *
10
+ * LED-Cube is free software: you can redistribute it and/or modify
11
+ * it under the terms of the GNU General Public License as published by
12
+ * the Free Software Foundation, either version 3 of the License, or
13
+ * (at your option) any later version.
14
+ *
15
+ * LED-Cube is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with LED-Cube.  If not, see <http://www.gnu.org/licenses/>.
22
+ */
23
+
24
+// First image loaded after initializing cube code.
25
+// Only visible for a short period of time after every reset.
26
+uint8_t defaultImageCube[64] = {	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
27
+									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
28
+									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
29
+									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
30
+									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
31
+									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
32
+									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
33
+									0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
34
+
35
+// Idle animation. Displayed when no animations are stored in memory.
36
+uint8_t defaultImageA[64] = {	0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
37
+								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
38
+								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
39
+								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
40
+								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
41
+								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
42
+								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
43
+								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff };
44
+
45
+uint8_t defaultImageB[64] = {	0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
46
+								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
47
+								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
48
+								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
49
+								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
50
+								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
51
+								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
52
+								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81 };
53
+
54
+uint8_t defaultImageC[64] = {	0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
55
+								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
56
+								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
57
+								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
58
+								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
59
+								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
60
+								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
61
+								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02 };
62
+
63
+#define IDLEANIMATIONCOUNT 3
64
+uint8_t *idleAnimation[IDLEANIMATIONCOUNT] = { defaultImageA, defaultImageB, defaultImageC };

+ 0
- 2
CubeFirmware/header/buffhelp.h Переглянути файл

@@ -23,6 +23,4 @@
23 23
 uint8_t *buffNew(void);
24 24
 void buffSetPixel(uint8_t *buffer, uint8_t x, uint8_t y, uint8_t z);
25 25
 void buffClearPixel(uint8_t *buffer, uint8_t x, uint8_t y, uint8_t z);
26
-void buffFillRect(uint8_t *buffer, uint8_t x1, uint8_t y1, uint8_t z1,
27
-					uint8_t x2, uint8_t y2, uint8_t z2, uint8_t value);
28 26
 void buffFree(uint8_t *buffer);

+ 66
- 82
CubeFirmware/main.c Переглянути файл

@@ -78,44 +78,7 @@ uint8_t lastButtonState = 0;
78 78
 uint8_t mcusr_mirror;
79 79
 char buffer[11];
80 80
 
81
-uint8_t defaultImageA[64] = {	0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
82
-								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
83
-								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
84
-								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
85
-								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
86
-								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
87
-								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff,
88
-								0xff, 0x01, 0x01, 0x01, 0xff, 0x80, 0x80, 0xff };
89
-
90
-uint8_t defaultImageB[64] = {	0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
91
-								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
92
-								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
93
-								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
94
-								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
95
-								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
96
-								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81,
97
-								0x7e, 0x81, 0x81, 0x81, 0xff, 0x81, 0x81, 0x81 };
98
-
99
-uint8_t defaultImageC[64] = {	0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
100
-								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
101
-								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
102
-								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
103
-								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
104
-								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
105
-								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02,
106
-								0x1e, 0x22, 0x22, 0x22, 0x1e, 0x02, 0x02, 0x02 };
107
-
108
-uint8_t defaultImageCube[64] = {	0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
109
-									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
110
-									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
111
-									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
112
-									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
113
-									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
114
-									0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF,
115
-									0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
116
-
117
-#define IDLEANIMATIONCOUNT 3
118
-uint8_t *idleAnimation[IDLEANIMATIONCOUNT] = { defaultImageA, defaultImageB, defaultImageC };
81
+#include "builtInFrames.c"
119 82
 
120 83
 uint8_t DebugDone = 0; // Bit 0: 10s int. count, Bit 1: unused
121 84
 					   // Bit 2: state changed, disable idle
@@ -146,10 +109,7 @@ int main(void) {
146 109
 	initSystemTimer();
147 110
 	sei(); // Enable Interrupts
148 111
 
149
-#ifndef DEBUG
150
-	// wdt_enable(WDTO_500MS); // Enable watchdog reset after 500ms
151 112
 	wdt_enable(WDTO_1S); // Watchdog reset after 1 second
152
-#endif
153 113
 
154 114
 	setImage(defaultImageCube); // Display something
155 115
 
@@ -168,9 +128,10 @@ int main(void) {
168 128
 
169 129
 	serialWriteString(getString(2));
170 130
 	serialWriteString(getString(0));
171
-	serialWriteString("Took ");
131
+	
132
+	/* serialWriteString("Took ");
172 133
 	serialWriteString(itoa(getSystemTime(), buffer, 10));
173
-	serialWriteString(" ms!\n");
134
+	serialWriteString(" ms!\n"); */
174 135
 
175 136
 	if (mcusr_mirror & WDRF) {
176 137
 		serialWriteString(getString(31));
@@ -192,6 +153,7 @@ int main(void) {
192 153
 
193 154
 	i = 0;
194 155
 	count = getAnimationCount();
156
+
195 157
 	while (1) {
196 158
 		// Reset if requested
197 159
 		if (!shouldRestart) {
@@ -260,12 +222,12 @@ int main(void) {
260 222
 
261 223
 		// Show how stable we are running :)
262 224
 		if (((getSystemTime() % 60000) == 0) && (getSystemTime() > 0)) {
263
-			serialWriteString(getString(37));
225
+			// serialWriteString(getString(37));
264 226
 			printTime();
265 227
 		}
266 228
 #endif
267 229
 
268
-		if ((getSystemTime() - lastChecked) > 150) {
230
+		if ((getSystemTime() - lastChecked) > 150) { // Check button state every 150ms
269 231
 			lastMode = audioModeSelected();
270 232
 			lastChecked = getSystemTime();
271 233
 		} 
@@ -344,7 +306,7 @@ void randomAnimation(void) {
344 306
 
345 307
 void serialHandler(char c) {
346 308
 	// Used letters:
347
-	// a, c, d, e, g, i, n, q, r, s, t, v, x, y, 0, 1, 2, 3
309
+	// a, b, c, d, e, g, i, n, q, r, s, t, v, x, y, 0, 1, 2, 3, #
348 310
 #ifdef DEBUG
349 311
 	uint8_t i, y, z;
350 312
 	serialWrite(c);
@@ -397,7 +359,11 @@ void serialHandler(char c) {
397 359
 #ifdef DEBUG
398 360
 	case 'm': case 'M':
399 361
 		lastButtonState = !lastButtonState;
400
-		serialWriteString(getString(40));
362
+		if (lastButtonState) {
363
+			serialWriteString(getString(41));
364
+		} else {
365
+			serialWriteString(getString(40));
366
+		}
401 367
 		break;
402 368
 
403 369
 	case 'q': case 'Q':
@@ -553,70 +519,88 @@ void sendAudioData(void) {
553 519
 }
554 520
 #endif
555 521
 
522
+#define TRANSTIMEOUT 10000
523
+
556 524
 void recieveAnimations() {
557
-	uint8_t animCount, a, frameCount, f, i;
558
-	uint16_t completeCount = 0, character;
559
-	uint8_t frame[65];
525
+	uint8_t animCount, a, frameCount, f, i, c;
526
+	uint16_t completeCount = 0;
527
+	uint8_t *frame = (uint8_t *)malloc(65);
528
+	uint64_t timestamp = getSystemTime();
560 529
 
561 530
 	serialWrite(OK); // We are ready...
562 531
 
563
-	character = serialGet();
564
-	while (character & 0xFF00) { // Wait for answer
565
-		character = serialGet();
532
+	while (!serialHasChar()) { // Wait for answer
533
+		if ((getSystemTime() - timestamp) <= TRANSTIMEOUT) {
534
+			wdt_reset();
535
+		}
566 536
 	}
567
-
568
-	animCount = (uint8_t)(character & 0x00FF); // Got animation count
537
+	c = serialGet();
538
+	animCount = c; // Got animation count
569 539
 	serialWrite(OK);
570 540
 
571 541
 	for (a = 0; a < animCount; a++) {
572
-		character = serialGet();
573
-		while (character & 0xFF00) { // Wait for answer
574
-			character = serialGet();
542
+		while (!serialHasChar()) { // Wait for answer
543
+			if ((getSystemTime() - timestamp) <= TRANSTIMEOUT) {
544
+				wdt_reset();
545
+			}
575 546
 		}
576
-
577
-		frameCount = (uint8_t)(character & 0x00FF); // Got frame count
547
+		c = serialGet();
548
+		frameCount = c; // Got frame count
578 549
 		serialWrite(OK);
579 550
 
580 551
 		for (f = 0; f < frameCount; f++) {
581
-			character = serialGet();
582
-			while (character & 0xFF00) { // Wait for answer
583
-				character = serialGet();
552
+			while (!serialHasChar()) { // Wait for answer
553
+				if ((getSystemTime() - timestamp) <= TRANSTIMEOUT) {
554
+					wdt_reset();
555
+				}
584 556
 			}
585
-
586
-			frame[64] = (uint8_t)(character & 0x00FF); // Got duration
557
+			c = serialGet();
558
+			frame[64] = c; // Got duration
587 559
 			serialWrite(OK);
588 560
 
589 561
 			for (i = 0; i < 64; i++) {
590
-				character = serialGet();
591
-				while (character & 0xFF00) { // Wait for answer
592
-					character = serialGet();
562
+				while (!serialHasChar()) { // Wait for answer
563
+					if ((getSystemTime() - timestamp) <= TRANSTIMEOUT) {
564
+						wdt_reset();
565
+					}
593 566
 				}
594
-
595
-				frame[i] = (uint8_t)(character & 0x00FF); // Got data byte
567
+				c = serialGet();
568
+				frame[i] = c; // Got data byte
596 569
 			}
597 570
 			serialWrite(OK);
598 571
 
599 572
 			setFrame(completeCount++, frame);
600 573
 		}
601 574
 	}
575
+	free(frame);
602 576
 
603
-	character = serialGet();
604
-	while (character & 0xFF00) { // Wait for answer
605
-		character = serialGet();
577
+	while (!serialHasChar()) { // Wait for answer
578
+		if ((getSystemTime() - timestamp) <= TRANSTIMEOUT) {
579
+			wdt_reset();
580
+		}
606 581
 	}
607
-	character = serialGet();
608
-	while (character & 0xFF00) { // Wait for answer
609
-		character = serialGet();
582
+	c = serialGet();
583
+	while (!serialHasChar()) { // Wait for answer
584
+		if ((getSystemTime() - timestamp) <= TRANSTIMEOUT) {
585
+			wdt_reset();
586
+		}
610 587
 	}
611
-	character = serialGet();
612
-	while (character & 0xFF00) { // Wait for answer
613
-		character = serialGet();
588
+	c = serialGet();
589
+	while (!serialHasChar()) { // Wait for answer
590
+		if ((getSystemTime() - timestamp) <= TRANSTIMEOUT) {
591
+			wdt_reset();
592
+		}
614 593
 	}
615
-	character = serialGet();
616
-	while (character & 0xFF00) { // Wait for answer
617
-		character = serialGet();
594
+	c = serialGet();
595
+	while (!serialHasChar()) { // Wait for answer
596
+		if ((getSystemTime() - timestamp) <= TRANSTIMEOUT) {
597
+			wdt_reset();
598
+		}
618 599
 	}
600
+	c = serialGet();
601
+
619 602
 	serialWrite(OK);
603
+
620 604
 	setAnimationCount(completeCount);
621 605
 	refreshAnimationCount = 1;
622 606
 }

+ 523
- 0
CubeFirmware/main.hex Переглянути файл

@@ -0,0 +1,523 @@
1
+:100000000C9441020C945E020C945E020C945E020D
2
+:100010000C945E020C945E020C945E020C94E70A4F
3
+:100020000C945E020C945E020C94E60C0C945E023E
4
+:100030000C945E020C94A0080C94CE080C945E0202
5
+:100040000C945E020C945E020C945E020C945E02B0
6
+:100050000C945E0276322E332052656C65617365B6
7
+:100060000A00496E697469616C697A65643A2000B6
8
+:1000700053656C662D54657374204572726F723AC5
9
+:1000800020306200203D3E204E6F20616E73776508
10
+:10009000722066726F6D20417564696F210A0020BD
11
+:1000A0003D3E204E6F20616E737765722066726FE1
12
+:1000B0006D204D656D6F7279210A00203D3E204311
13
+:1000C000616E277420777269746520746F204D65A6
14
+:1000D0006D6F7279210A00286429656C6574652C3E
15
+:1000E00020286729657420616E696D732C20287340
16
+:1000F00029657420616E696D732C202876296572DC
17
+:1001000073696F6E0A00287429696D652C20286157
18
+:10011000297564696F2C202863296F756E742C20F3
19
+:10012000287829437573746F6D20636F756E740A38
20
+:100130000028792953657420666978656420616EAA
21
+:10014000696D6174696F6E20636F756E740A005318
22
+:100150002865296C6620546573742C20286D296FDE
23
+:1001600064650A00506C61792053286E29616B65C3
24
+:100170000A00416C6C204C454473204F66662F4F3B
25
+:100180006E2028302F31290A002832293A20546560
26
+:10019000737420416E696D2E20310A002833293A8C
27
+:1001A00020416C6C2053757266616365204C454438
28
+:1001B00073206F6E0A0053797374656D2054696DF6
29
+:1001C000653A2000204672616D65732073746F720A
30
+:1001D00065640A0053656E64206120627974652E3F
31
+:1001E0002E2E2000207772697474656E210A0041FA
32
+:1001F0006E696D6174696F6E20636F756E74206EC9
33
+:100200006F772038373035210A0053656C662D54DE
34
+:100210006573743A203062004B696C6C65642041F0
35
+:100220006E696D6174696F6E20436F756E7465726F
36
+:10023000210A00436F756C64206E6F7420616363E4
37
+:1002400065737320646576696365210A004175648E
38
+:10025000696F20446174613A0A00436F6E74726F73
39
+:100260006C733A2057204120532044205120452CC4
40
+:10027000207820746F20717569740A0052616E20B5
41
+:100280006F7574206F662048656170210A00416EA9
42
+:10029000696D6174696F6E2061626F72746564214B
43
+:1002A0000A002869296E7465727275707420636F14
44
+:1002B000756E742C20287229616E646F6D2C202855
45
+:1002C000712972657365740A0020496E74657272D3
46
+:1002D0007570747320616674657220313030306DD2
47
+:1002E0007365630A00204672616D657320706572E4
48
+:1002F000205365636F6E640A004D656D6F727920DF
49
+:1003000064656C65746564210A00526573657420C8
50
+:10031000696E203530306D732E20427965210A00D8
51
+:100320005761746368646F672052657365742064F5
52
+:10033000657465637465642E0A0042726F776E2D72
53
+:100340004F757420526573657420646574656374B9
54
+:1003500065642E0A004E6F205265736574207265C5
55
+:1003600061736F6E2064657465637465642E0A0042
56
+:1003700045787465726E616C205265736574206493
57
+:10038000657465637465642E0A004A5441472052BF
58
+:10039000657365742064657465637465642E0A0012
59
+:1003A000506F7765722D4F6E2052657365742064AF
60
+:1003B000657465637465642E0A0059617921204172
61
+:1003C0006E6F74686572206D696E757465207061FA
62
+:1003D00073736564203A290A00417564696F204D82
63
+:1003E0006F6465210A0043756265204D6F64652165
64
+:1003F0000A0043756265206D6F646520656E7465E3
65
+:10040000726564210A00417564696F206D6F6465CF
66
+:1004100020656E7465726564210A00540070006284
67
+:100420000084009F00BB00D700060131014F01642A
68
+:1004300001720189019C01B601C401D401E401EFFC
69
+:10044000010A02180233024D025A027C028E02A2F5
70
+:1004500002C902E502F9020A0320033A03550370B8
71
+:10046000038A03A003BA03D903E603F20306045385
72
+:100470007472696E67206E6F7420666F756E64218A
73
+:100480000A0011241FBECFE5D8E0DEBFCDBF11E0CA
74
+:10049000A0E6B0E0EAE8FFE102C005900D92AE36BA
75
+:1004A000B107D9F712E0AEE6B1E001C01D92A23566
76
+:1004B000B107E1F70E9476070C94C30F0C9400007B
77
+:1004C000B0990AC080916F01882321F481E0809364
78
+:1004D0006F0102C010926F0180916F0108957F92A9
79
+:1004E0008F929F92AF92BF92CF92DF92EF92FF9244
80
+:1004F0000F931F93CF93DF930E94750D7C016FEFD5
81
+:1005000070E00E94A30E892B39F4C7016FEF70E0F1
82
+:100510000E94A30E762E07C0C7016FEF70E00E9405
83
+:10052000A30E762E739482E40E94A809872D0E9460
84
+:10053000A8090E94530990E08234910509F061C036
85
+:10054000AA24BB244BC08FEFE816F10421F018F069
86
+:1005500088248A9401C08E2C882D0E94A8090E94AC
87
+:10056000530990E08234910509F04BC0650199244C
88
+:100570002DC0C6010E94E80D8C01FC01E05CFF4F1C
89
+:1005800080810E94A8090E94530990E0823491055D
90
+:10059000A9F4C0E0D0E0F801EC0FFD1F80810E94BB
91
+:1005A000A8092196C034D105B1F70E94530990E003
92
+:1005B0000894C11CD11C8234910521F0C8010E940D
93
+:1005C000640F1FC0C8010E94640F9394981488F2AE
94
+:1005D000E818F1088FEF90E0A80EB91E8A2D8195DA
95
+:1005E000871508F4B0CF82E40E94A80982E40E9433
96
+:1005F000A80982E40E94A80982E40E94A8090E9436
97
+:100600005309DF91CF911F910F91FF90EF90DF90F1
98
+:10061000CF90BF90AF909F908F907F9008952F9232
99
+:100620003F924F925F926F927F928F929F92AF9282
100
+:10063000BF92CF92DF92EF92FF920F931F93DF93BF
101
+:10064000CF93CDB7DEB727970FB6F894DEBF0FBEB6
102
+:10065000CDBF81E490E00E94B70E7C010E94550D51
103
+:10066000422E332E242E752E662E572E982E892E2E
104
+:1006700082E40E94A8096CC00E94550D022F041943
105
+:10068000F1E0201708F0F0E0232F2319E1E0321702
106
+:1006900008F0E0E0A22FAF1B31E02A1708F030E0AD
107
+:1006A000E32B242F2219F1E0421708F0F0E0B22FDB
108
+:1006B000BE1B31E02B1708F030E0F32B252F271954
109
+:1006C00041E0521708F040E0E22FEF1B31E02E1717
110
+:1006D00008F030E0432B262F261951E0621708F06E
111
+:1006E00050E0622F641B31E0261708F030E0532BF6
112
+:1006F000272F251941E0721708F040E0322F351BF3
113
+:10070000532F31E0251708F030E0432B282F29190B
114
+:1007100031E0821708F030E0822F841B482F81E0FF
115
+:10072000241708F080E0382B9819931789F4442394
116
+:1007300079F4552369F4662359F4EE2349F4BB2375
117
+:1007400039F4A83228F4A73211F4013108F4A8953D
118
+:100750000E944409882309F48FCF0E9453098A8399
119
+:1007600082E40E94A8091B82AA24BB24F701E05C52
120
+:10077000FF4FFD83EC8388C10E94550D022F0419A1
121
+:10078000F1E0201708F0F0E0232F2319E1E0321701
122
+:1007900008F0E0E0A22FAF1B31E02A1708F030E0AC
123
+:1007A000E32B242F2219F1E0421708F0F0E0B22FDA
124
+:1007B000BE1B31E02B1708F030E0F32B252F271953
125
+:1007C00041E0521708F040E0E22FEF1B31E02E1716
126
+:1007D00008F030E0432B262F261951E0621708F06D
127
+:1007E00050E0622F641B31E0261708F030E0532BF5
128
+:1007F000272F251941E0721708F040E0F22FF51B72
129
+:100800005F2F31E02F1708F030E0432B282F2919F4
130
+:1008100031E0821708F030E0822F841B482F81E0FE
131
+:10082000241708F080E0382B9819931789F4442393
132
+:1008300079F4552369F4662359F4EE2349F4BB2374
133
+:1008400039F4A83228F4A73211F4013108F4A8953C
134
+:100850000E944409882309F48FCF0E945309898399
135
+:1008600082E40E94A809650104C10E94550D022F6F
136
+:100870000419F1E0201708F0F0E0232F2319E1E03C
137
+:10088000321708F0E0E0A22FAF1B31E02A1708F082
138
+:1008900030E0E32B242F2219F1E0421708F0F0E0BA
139
+:1008A000B22FBE1B31E02B1708F030E0F32B252FC1
140
+:1008B000271941E0521708F040E0E22FEF1B31E02A
141
+:1008C0002E1708F030E0432B262F261951E062172F
142
+:1008D00008F050E0622F641B31E0261708F030E08A
143
+:1008E000532B272F251941E0721708F040E0F22F13
144
+:1008F000F51B5F2F31E02F1708F030E0432B282F36
145
+:10090000291931E0821708F030E0822F841B482F2C
146
+:1009100081E0241708F080E0382B9819931789F4A8
147
+:10092000442379F4552369F4662359F4EE2349F4FA
148
+:10093000BB2339F4A83228F4A73211F4013108F4AA
149
+:10094000A8950E944409882309F48FCF0E94530977
150
+:10095000EC81FD81808382E40E94A809FF82EE82FF
151
+:100960006CC00E94550D022F0419F1E0201708F009
152
+:10097000F0E0232F2319E1E0321708F0E0E0A22F86
153
+:10098000AF1B31E02A1708F030E0E32B242F2219A7
154
+:10099000F1E0421708F0F0E0B22FBE1B31E02B1758
155
+:1009A00008F030E0F32B252F271941E0521708F00B
156
+:1009B00040E0E22FEF1B31E02E1708F030E0432B30
157
+:1009C000262F261951E0621708F050E0622F641BB1
158
+:1009D00031E0261708F030E0532B272F251941E08E
159
+:1009E000721708F040E0F22FF51B5F2F31E02F1750
160
+:1009F00008F030E0432B282F291931E0821708F046
161
+:100A000030E0822F841B482F81E0241708F080E01B
162
+:100A1000382B9819931789F4442379F4552369F4F2
163
+:100A2000662359F4EE2349F4BB2339F4A83228F4A1
164
+:100A3000A73211F4013108F4A8950E9444098823D3
165
+:100A400009F48FCF0E945309EE81FF818193FF83C8
166
+:100A5000EE832C813D81E217F30779F782E40E944F
167
+:100A6000A80986010F5F1F4FC601B7010E94D10D73
168
+:100A700068018C2D8A193981831708F462CFA30E7F
169
+:100A8000B11C8B818F5F8B839B81EA819E1708F459
170
+:100A9000DFCEC7010E94640F6CC00E94550D022F6B
171
+:100AA0000419F1E0201708F0F0E0232F2319E1E00A
172
+:100AB000321708F0E0E0A22FAF1B31E02A1708F050
173
+:100AC00030E0E32B242F2219F1E0421708F0F0E088
174
+:100AD000B22FBE1B31E02B1708F030E0F32B252F8F
175
+:100AE000271941E0521708F040E0E22FEF1B31E0F8
176
+:100AF0002E1708F030E0432B262F261951E06217FD
177
+:100B000008F050E0622F641B31E0261708F030E057
178
+:100B1000532B272F251941E0721708F040E0F22FE0
179
+:100B2000F51B5F2F31E02F1708F030E0432B282F03
180
+:100B3000291931E0821708F030E0822F841B482FFA
181
+:100B400081E0241708F080E0382B9819931789F476
182
+:100B5000442379F4552369F4662359F4EE2349F4C8
183
+:100B6000BB2339F4A83228F4A73211F4013108F478
184
+:100B7000A8950E944409882309F48FCF0E94530945
185
+:100B80006CC00E94550D022F0419F1E0201708F0E7
186
+:100B9000F0E0232F2319E1E0321708F0E0E0A22F64
187
+:100BA000AF1B31E02A1708F030E0E32B242F221985
188
+:100BB000F1E0421708F0F0E0B22FBE1B31E02B1736
189
+:100BC00008F030E0F32B252F271941E0521708F0E9
190
+:100BD00040E0E22FEF1B31E02E1708F030E0432B0E
191
+:100BE000262F261951E0621708F050E0622F641B8F
192
+:100BF00031E0261708F030E0532B272F251941E06C
193
+:100C0000721708F040E0F22FF51B5F2F31E02F172D
194
+:100C100008F030E0432B282F291931E0821708F023
195
+:100C200030E0822F841B482F81E0241708F080E0F9
196
+:100C3000382B9819931789F4442379F4552369F4D0
197
+:100C4000662359F4EE2349F4BB2339F4A83228F47F
198
+:100C5000A73211F4013108F4A8950E9444098823B1
199
+:100C600009F48FCF0E9453096CC00E94550D022FCA
200
+:100C70000419F1E0201708F0F0E0232F2319E1E038
201
+:100C8000321708F0E0E0A22FAF1B31E02A1708F07E
202
+:100C900030E0E32B242F2219F1E0421708F0F0E0B6
203
+:100CA000B22FBE1B31E02B1708F030E0F32B252FBD
204
+:100CB000271941E0521708F040E0E22FEF1B31E026
205
+:100CC0002E1708F030E0432B262F261951E062172B
206
+:100CD00008F050E0622F641B31E0261708F030E086
207
+:100CE000532B272F251941E0721708F040E0F22F0F
208
+:100CF000F51B5F2F31E02F1708F030E0432B282F32
209
+:100D0000291931E0821708F030E0822F841B482F28
210
+:100D100081E0241708F080E0382B9819931789F4A4
211
+:100D2000442379F4552369F4662359F4EE2349F4F6
212
+:100D3000BB2339F4A83228F4A73211F4013108F4A6
213
+:100D4000A8950E944409882309F48FCF0E94530973
214
+:100D50006CC00E94550D022F0419F1E0201708F015
215
+:100D6000F0E0232F2319E1E0321708F0E0E0A22F92
216
+:100D7000AF1B31E02A1708F030E0E32B242F2219B3
217
+:100D8000F1E0421708F0F0E0B22FBE1B31E02B1764
218
+:100D900008F030E0F32B252F271941E0521708F017
219
+:100DA00040E0E22FEF1B31E02E1708F030E0432B3C
220
+:100DB000262F261951E0621708F050E0622F641BBD
221
+:100DC00031E0261708F030E0532B272F251941E09A
222
+:100DD000721708F040E0F22FF51B5F2F31E02F175C
223
+:100DE00008F030E0432B282F291931E0821708F052
224
+:100DF00030E0822F841B482F81E0241708F080E028
225
+:100E0000382B9819931789F4442379F4552369F4FE
226
+:100E1000662359F4EE2349F4BB2339F4A83228F4AD
227
+:100E2000A73211F4013108F4A8950E9444098823DF
228
+:100E300009F48FCF0E94530982E40E94A809C501DA
229
+:100E40000E94A00D81E08093600027960FB6F89471
230
+:100E5000DEBF0FBECDBFCF91DF911F910F91FF90ED
231
+:100E6000EF90DF90CF90BF90AF909F908F907F904A
232
+:100E70006F905F904F903F902F900895863561F16D
233
+:100E8000873580F4873411F1883438F48234E1F006
234
+:100E90008434C1F08F3331F513C0883489F0833541
235
+:100EA00009F517C0883661F0893628F4843651F088
236
+:100EB0008736C1F40BC0833761F0863799F40CC0D4
237
+:100EC00086E00BC00E94B20D82E40DC00E946F024A
238
+:100ED00008950E940F03089580E00E94FA0D0E9479
239
+:100EE000E509089583E20E94A80908954F925F9250
240
+:100EF0006F927F928F929F92AF92BF92CF92DF922A
241
+:100F0000EF92FF920F931F93CF93DF9384B7809359
242
+:100F10008A0114BE98E10FB6F89491BD11BC0FBEC2
243
+:100F20008FEF8ABB8CEF81BB97BB84BB87B3866096
244
+:100F300087BBB8980E946C0A89E190E068E040E0C5
245
+:100F400021E00E9410090E94610B0E94DD0C789440
246
+:100F50002EE088E190E00FB6F894A89581BD0FBE11
247
+:100F600021BD81E690E00E94120A0E946002482E94
248
+:100F70000E94550D522E632E742E852E962EA72E6E
249
+:100F8000B82EC92E0E94750DEC01FF24DD24EE243D
250
+:100F900080916E01882309F4A895442069F00E948D
251
+:100FA000680A882309F44CC00E94BE0C009709F41B
252
+:100FB00047C00E945C0E44C080916000882331F0DD
253
+:100FC0000E94750DEC0110926000FF24209701F142
254
+:100FD0000E94680AD816A0F52F2D30E0CE010197A7
255
+:100FE0002817390710F0FF2401C0F3948F2D90E0EB
256
+:100FF0000E94E80D8C01005C1F4FF801D080005466
257
+:101000001040C8010E94120AC8010E94640F18C053
258
+:101010008091700182FD14C00E94680A803380F0C4
259
+:10102000EE2DF0E0EE0FFF1FEF59FE4F8081918112
260
+:101030000E94120AF1E0FE1510F4EE2401C0E394C0
261
+:101040000E944409882321F00E9453090E943E0710
262
+:101050000E94550D022F0519F1E0201708F0F0E06D
263
+:10106000232F2619E1E0321708F0E0E0B22FBF1B72
264
+:1010700031E02B1708F030E0E32B242F2719F1E0A3
265
+:10108000421708F0F0E0A22FAE1B31E02A1708F05B
266
+:1010900030E0F32B252F281941E0521708F040E0EB
267
+:1010A000E22FEF1B31E02E1708F030E0432B262F04
268
+:1010B000291951E0621708F050E0622F641B31E0FB
269
+:1010C000261708F030E0532B272F2A1941E072171A
270
+:1010D00008F040E0322F351B532F31E0251708F080
271
+:1010E00030E0432B282F2B1931E0821708F030E035
272
+:1010F000822F841B482F81E0241708F080E0382BD2
273
+:101100009C19931779F4442369F4552359F4662301
274
+:1011100049F4EE2339F4AA2329F4BB2319F407393F
275
+:1011200008F436CF0E946002482E0E94550D522EC0
276
+:10113000632E742E852E962EA72EB82EC92E28CF5C
277
+:101140001F920F920FB60F9211248F939F93EF93DC
278
+:10115000FF93E0917301F09174018CB1E557FE4F5C
279
+:10116000808380917301909174014F9750F4809126
280
+:1011700073019091740101969093740180937301AF
281
+:1011800004C01092740110927301FF91EF919F912E
282
+:101190008F910F900FBE0F901F9018951F920F9276
283
+:1011A0000FB60F9211242F933F938F939F93EF933A
284
+:1011B000FF93209175013091760180917701909194
285
+:1011C000780128173907E9F0E0917501F09176016F
286
+:1011D000E555FE4F80818CB9809175019091760123
287
+:1011E0004F9750F4809175019091760101969093FC
288
+:1011F00076018093750109C01092760110927501F5
289
+:1012000004C081E0809367015598FF91EF919F9111
290
+:101210008F913F912F910F900FBE0F901F901895B7
291
+:10122000382F433078F5862F8550843058F5822F3B
292
+:101230008150823038F5442341F080B5806280BD12
293
+:10124000423019F480B5806180BD223019F480B538
294
+:10125000886080BD653079F0663011F0683018F034
295
+:1012600080B5826080BD673030F080B5846080BD1D
296
+:10127000693009F4529A90BD39B98AB188698AB93E
297
+:1012800080E0089581E0089520917101309172010C
298
+:10129000809173019091740140E02817390709F09B
299
+:1012A00041E0842F08952091710130917201809165
300
+:1012B0007301909174012817390711F420E022C0BE
301
+:1012C000E0917101F0917201E557FE4F2081E091AC
302
+:1012D0007101F0917201E557FE4F1082809171010A
303
+:1012E000909172014F9750F4809171019091720129
304
+:1012F0000196909372018093710104C01092720163
305
+:1013000010927101822F0895809177019091780158
306
+:10131000209175013091760101968217930719F497
307
+:1013200081E090E008958091750190917601892B7C
308
+:1013300019F080E090E00895809177019091780114
309
+:1013400020E030E04F9711F421E030E0C90108952A
310
+:10135000482F80917701909178012091750130910B
311
+:101360007601019682179307A1F380917501909100
312
+:101370007601892B31F480917701909178014F9714
313
+:1013800041F3E0917701F0917801E555FE4F4083FC
314
+:1013900080917701909178014F9750F48091770177
315
+:1013A000909178010196909378018093770104C021
316
+:1013B000109278011092770180916701813021F4B9
317
+:1013C00010926701559A5D9A0895CF93DF93EC01CF
318
+:1013D00003C021960E94A80988818823D1F7DF9154
319
+:1013E000CF9108951AB810BC10BC19B810927201B0
320
+:1013F0001092710110927601109275011092740191
321
+:101400001092730110927801109277010895209143
322
+:101410007D0130917E0140917F0150918001B901A1
323
+:10142000CA0108951F931FB7F89421E02093790112
324
+:1014300010927A0110927C01BC0140E050E019C08A
325
+:101440008D918095F90193E0EE0FFF1F9A95E1F7DA
326
+:10145000E40FF51FE553FE4F80832F5F3F4F283089
327
+:10146000310571F74F5F5F4F685F7F4F483051051F
328
+:1014700021F0DB0120E030E0E3CF1FBF1F91089592
329
+:10148000682F7FB7F89481E08093790110927A01F8
330
+:1014900010927C0120E030E060950FC0FA01E80F67
331
+:1014A000F91FE553FE4F6083019688309105B1F72F
332
+:1014B0002F5F3F4F2830310549F080E090E0A901CF
333
+:1014C000E3E0440F551FEA95E1F7E8CF7FBF0895A9
334
+:1014D00080917A01869508958EB589608EBD82ECE3
335
+:1014E00092EA9BBD8ABD80E189BF80E00E94400AEC
336
+:1014F000789440E050E091E01EC08FB7F894FB0173
337
+:10150000E20FF31FE553FE4FA08110829093790103
338
+:1015100010927A0110927C018FBF80917A0188230A
339
+:10152000E1F32F5F3F4F2830310539F74F5F5F4FB1
340
+:101530004830510549F020E030E0BA01F3E0660F91
341
+:10154000771FFA95E1F7D9CFF89410927D011092A8
342
+:101550007E0110927F011092800110927A01109208
343
+:101560007C01089589B78F7E89BF0895982F9C7F4D
344
+:1015700092BB98B3880F880F880F8871977E982B3D
345
+:1015800098BB0895382F85B3837085BB88B3897F56
346
+:1015900088BB323058F025B381E090E002C0880F5C
347
+:1015A000991F3A95E2F7282B25BB0EC048B3232F8D
348
+:1015B00030E02F5F3F4F81E090E002C0880F991F1D
349
+:1015C0002A95E2F7482B48BB6BBB000008951F9299
350
+:1015D0000F920FB60F9211242F933F934F935F9367
351
+:1015E0006F937F938F939F93AF93BF93CF93DF932B
352
+:1015F000EF93FF9380917C0180917901882321F002
353
+:1016000010927B011092790180E00E94B60AC0E03E
354
+:10161000D0E0E0917B01F0E0A3E0EE0FFF1FAA9580
355
+:10162000E1F7EC0FFD1FE553FE4F60818C2F0E9408
356
+:10163000C20A2196C830D10561F720917B0181E073
357
+:1016400090E002C0880F991F2A95E2F70E94B60A1F
358
+:1016500080917B01873030F480917B018F5F809394
359
+:101660007B0107C010927B0180917A018F5F80938C
360
+:101670007A0110927C0180917D0190917E01A09170
361
+:101680007F01B09180010196A11DB11D80937D0164
362
+:1016900090937E01A0937F01B0938001FF91EF9121
363
+:1016A000DF91CF91BF91AF919F918F917F916F917A
364
+:1016B0005F914F913F912F910F900FBE0F901F9010
365
+:1016C000189511B88CE080B90895982F84EA86BFE8
366
+:1016D00006B607FEFDCF81B1887F883021F08031CA
367
+:1016E00011F081E0089593B984E886BF06B607FE3D
368
+:1016F000FDCF91B1987F983111F480E0089580E09A
369
+:10170000903409F081E0089544EA34E824E946BFC2
370
+:1017100006B607FEFDCF91B1987F983011F0903159
371
+:10172000B1F783B936BF06B607FEFDCF91B1987FFA
372
+:10173000903211F0983529F426BF06B604FCFDCF8F
373
+:10174000E6CF08950E94650B089584E986BF06B62A
374
+:1017500004FCFDCF089583B984E886BF06B607FE72
375
+:10176000FDCF81B190E0887F883209F091E0892F28
376
+:10177000089584EC86BF06B607FEFDCF83B10895B9
377
+:1017800084E886BF06B607FEFDCF83B10895BF92F9
378
+:10179000CF92DF92EF92FF920F931F93CF93DF933D
379
+:1017A0007B018C01D42EC52EB22E80E0E81680E09D
380
+:1017B000F80681E0080780E0180710F082EA01C00F
381
+:1017C00080EA0E94650B882399F40E94AB0B8E2D52
382
+:1017D0000E94AB0B8D2D9C2D9C01E90110E004C0F3
383
+:1017E00089910E94AB0B1F5F1B15D0F30E94A50BC4
384
+:1017F000DF91CF911F910F91FF90EF90DF90CF90ED
385
+:10180000BF900895DF92EF92FF920F931F937B0199
386
+:101810008C01D42E80E0E81680E0F80681E008070D
387
+:1018200080E0180710F082EA01C080EA0E94650B90
388
+:10183000882351F40E94AB0B8E2D0E94AB0B8D2D93
389
+:101840000E94AB0B0E94A50B1F910F91FF90EF9090
390
+:10185000DF9008956F927F928F929F92AF92BF9286
391
+:10186000CF92DF92FF920F931F93CF93DF934B01A1
392
+:101870005C0180E0881680E0980681E0A80680E0A0
393
+:10188000B80618F092EAF92E02C080EAF82E642E0B
394
+:101890007724C3010E94B70E8C016C01009769F197
395
+:1018A0008F2D0E94650B882319F0CC24DD2425C0E0
396
+:1018B00080E00E94AB0B882D0E94AB0B8F2D8160C6
397
+:1018C0000E94A20BFF2453010894A108B10806C08E
398
+:1018D0000E94B90BC00FD11F8883F394CF2DD0E0A5
399
+:1018E000CA15DB05ACF30E94C00B060D171D015095
400
+:1018F0001040F80180830E94A50BC601DF91CF91B3
401
+:101900001F910F91FF90DF90CF90BF90AF909F906D
402
+:101910008F907F906F900895DF92EF92FF920F93D8
403
+:101920001F937B018C0180E0E81680E0F80681E0DF
404
+:10193000080780E0180718F032EAD32E02C020EA28
405
+:10194000D22E8D2D0E94650B882311F010E00FC060
406
+:1019500080E00E94AB0B8E2D0E94AB0B8D2D816021
407
+:101960000E94A20B0E94C00B182F0E94A50B812F72
408
+:101970001F910F91FF90EF90DF900895CF93DF9329
409
+:1019800083E40E94650B882319F020E030E011C049
410
+:10199000CBE0D2E00E94B90B899382E0C131D80735
411
+:1019A000C9F70E94C00B88830E94A50B9E01265098
412
+:1019B0003040C901DF91CF91089583B78B6083BF19
413
+:1019C0008AEF8CBF89B7826089BF08951F920F92FA
414
+:1019D0000FB60F9211241F932F933F934F935F9352
415
+:1019E0006F937F938F939F93AF93BF93EF93FF93E7
416
+:1019F0008091820120918301309184014091850181
417
+:101A000060918601E0918701A09188011091890180
418
+:101A1000B82FBF5F91E0B81708F090E0F92FF20FF0
419
+:101A200081E0F21708F080E0782F730F81E07317E0
420
+:101A300008F080E0582F540F81E0541708F080E040
421
+:101A4000382F360F81E0361708F080E0282F2E0F50
422
+:101A500081E02E1708F080E0982F9A0F81E09A1706
423
+:101A600008F080E0810FB0938201F09383017093BE
424
+:101A700084015093850130938601209387019093D0
425
+:101A8000880180938901FF91EF91BF91AF919F9160
426
+:101A90008F917F916F915F914F913F912F911F9106
427
+:101AA0000F900FBE0F901F901895209182013091DA
428
+:101AB000830140918401509185016091860170916C
429
+:101AC0008701809188019091890108958E3110F0ED
430
+:101AD00080E00895682F70E06E5F7F4F882777FD64
431
+:101AE0008095982F0E948C0C08951F9360E070E001
432
+:101AF00080E090E00E948C0C182F61E070E080E0A4
433
+:101B000090E00E948C0C412F50E0382F20E0422BB7
434
+:101B1000532B87E0413E580710F040EE57E0CA01D2
435
+:101B20001F910895462F8E3150F4682F70E06E5F3C
436
+:101B30007F4F882777FD8095982F0E94020C08958B
437
+:101B40001F93482F192F60E070E080E090E00E9422
438
+:101B5000020C61E070E080E090E0412F0E94020CF6
439
+:101B60001F910895EF92FF920F931F93EE24FF248D
440
+:101B70008701C801B70140E00E94020C0894E11CF3
441
+:101B8000F11C011D111D80E0E81680E0F80682E0DE
442
+:101B9000080780E0180769F71F910F91FF90EF90F9
443
+:101BA00008950F931F93AB018C0126E0000F111FC6
444
+:101BB0002A95E1F7080F191F005E1F4F20E030E063
445
+:101BC000C901B80121E40E94C70B1F910F9108952C
446
+:101BD0009C0146E0220F331F4A95E1F7280F391F79
447
+:101BE000205E3F4F40E050E0CA01B90141E40E944D
448
+:101BF0002A0C08958A3248F4E82FF0E0EE0FFF1F18
449
+:101C0000E55EFB4F6591749104C0EFE6F4E06591E9
450
+:101C1000749182E192E00E94BC0F82E192E008950B
451
+:101C2000E7E0F0E0DF01A41BB109E21BF10923E0CA
452
+:101C3000EE0FFF1F2A95E1F7AE0FBF1FA80FB91FC8
453
+:101C400081E090E002C0880F991F6A95E2F72C911D
454
+:101C5000282B2C930895E7E0F0E0DF01A41BB109E5
455
+:101C6000E21BF10933E0EE0FFF1F3A95E1F7AE0FEB
456
+:101C7000BF1FA80FB91F81E090E002C0880F991F15
457
+:101C80006A95E2F780952C9128232C9308950E9461
458
+:101C9000640F089580E490E00E94B70E9C010097C5
459
+:101CA00009F4FFCFFC01805C9F4F1192E817F90700
460
+:101CB000E1F7C90108950895BF92CF92DF92EF92A4
461
+:101CC000FF920F931F93CF93DF936C010E944A0EF4
462
+:101CD0007C01C0E0D0E0F601EC0FFD1F80816FE1D8
463
+:101CE0000E94970EB82E00E00CC0C7016C2F412F48
464
+:101CF000202F0E94100E1F5F1B15BCF30F5F0830D2
465
+:101D000011F010E0F9CF2196C730D10521F7C701B6
466
+:101D10000E94120AC7010E94470EDF91CF911F91C6
467
+:101D20000F91FF90EF90DF90CF90BF900895991B97
468
+:101D300079E004C0991F961708F0961B881F7A95C2
469
+:101D4000C9F780950895AA1BBB1B51E107C0AA1FC4
470
+:101D5000BB1FA617B70710F0A61BB70B881F991F4C
471
+:101D60005A95A9F780959095BC01CD010895CF9320
472
+:101D7000DF93BC018230910510F462E070E0A09125
473
+:101D80005002B0915102ED01E0E0F0E040E050E09F
474
+:101D900021C0888199818617970769F48A819B8180
475
+:101DA000309719F09383828304C0909351028093FB
476
+:101DB0005002FE0134C06817790738F44115510507
477
+:101DC00019F08417950708F4AC01FE018A819B8104
478
+:101DD0009C01E9012097E9F641155105A9F1CA01D5
479
+:101DE000861B970B049708F4BA01E0E0F0E02AC0E4
480
+:101DF0008D919C91119784179507F9F464177507D5
481
+:101E000081F412968D919C911397309719F09383DA
482
+:101E1000828304C09093510280935002FD01329658
483
+:101E20004FC0CA01861B970BFD01E80FF91F619394
484
+:101E3000719302978D939C9343C0FD01828193819E
485
+:101E40009C01D9011097A1F680914E0290914F020A
486
+:101E5000892B41F480916A0190916B0190934F021C
487
+:101E600080934E0240916C0150916D0141155105D6
488
+:101E700041F44DB75EB78091680190916901481BAC
489
+:101E8000590B20914E0230914F0224173507B0F4C0
490
+:101E9000CA01821B930B8617970780F0AB014E5F38
491
+:101EA0005F4F8417950750F0420F531F50934F0216
492
+:101EB00040934E02F9016193719302C0E0E0F0E0BB
493
+:101EC000CF01DF91CF910895CF93DF93009709F46D
494
+:101ED00050C0EC0122971B821A82A0915002B0914F
495
+:101EE0005102109709F140E050E0AC17BD0708F12E
496
+:101EF000BB83AA83FE0121913191E20FF31FAE173C
497
+:101F0000BF0779F48D919C911197280F391F2E5F8F
498
+:101F10003F4F3983288312968D919C9113979B8311
499
+:101F20008A834115510571F4D0935102C093500238
500
+:101F300020C012968D919C911397AD01009711F0DE
501
+:101F4000DC01D3CFFA01D383C28321913191E20F17
502
+:101F5000F31FCE17DF0769F488819981280F391F95
503
+:101F60002E5F3F4FFA01318320838A819B819383C7
504
+:101F70008283DF91CF910895FB01DC0105900D92E2
505
+:0A1F80000020E1F70895F894FFCF68
506
+:101F8A0001FFFFFFFFFFFFFFFFFF81818181818149
507
+:101F9A00FFFF818181818181FFFF8181818181812F
508
+:101FAA00FFFF818181818181FFFF8181818181811F
509
+:101FBA00FFFF818181818181FFFFFFFFFFFFFFFF1B
510
+:101FCA00FFFF010101FF8080FFFF010101FF808007
511
+:101FDA00FFFF010101FF8080FFFF010101FF8080F7
512
+:101FEA00FFFF010101FF8080FFFF010101FF8080E7
513
+:101FFA00FFFF010101FF8080FFFF010101FF8080D7
514
+:10200A00FF7E818181FF8181817E818181FF818142
515
+:10201A00817E818181FF8181817E818181FF8181B0
516
+:10202A00817E818181FF8181817E818181FF8181A0
517
+:10203A00817E818181FF8181817E818181FF818190
518
+:10204A00811E2222221E0202021E2222221E0202B7
519
+:10205A00021E2222221E0202021E2222221E020226
520
+:10206A00021E2222221E0202021E2222221E020216
521
+:10207A00021E2222221E0202021E2222221E020206
522
+:0E208A0002A100E1002101012000520200002D
523
+:00000001FF

+ 5
- 11
CubeFirmware/makefile Переглянути файл

@@ -19,7 +19,7 @@
19 19
 # To rebuild project do "make clean" then "make all".
20 20
 #
21 21
 
22
-CDEFS = -D DEBUG
22
+#CDEFS = -D DEBUG
23 23
 
24 24
 # MCU name
25 25
 MCU = atmega32
@@ -262,7 +262,7 @@ ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS)
262 262
 
263 263
 
264 264
 # Default target.
265
-all: begin gccversion sizebefore build sizeafter finished end
265
+all: begin gccversion sizebefore build finished end clean
266 266
 
267 267
 build: elf hex eep lss sym
268 268
 
@@ -390,18 +390,12 @@ extcoff: $(TARGET).elf
390 390
 
391 391
 
392 392
 # Target: clean project.
393
-clean: begin clean_list2 finished end
394
-
395
-clean_list2: clean_list
396
-	$(REMOVE) $(TARGET).hex
393
+clean: begin clean_list finished end
397 394
 
398 395
 clean_list:
399
-	@echo
400
-	@echo $(MSG_CLEANING)
401 396
 	$(REMOVE) $(TARGET).eep
402 397
 	$(REMOVE) $(TARGET).obj
403 398
 	$(REMOVE) $(TARGET).cof
404
-	$(REMOVE) $(TARGET).elf
405 399
 	$(REMOVE) $(TARGET).map
406 400
 	$(REMOVE) $(TARGET).obj
407 401
 	$(REMOVE) $(TARGET).a90
@@ -413,8 +407,8 @@ clean_list:
413 407
 	$(REMOVE) $(SRC:.c=.s)
414 408
 	$(REMOVE) $(SRC:.c=.d)
415 409
 	$(REMOVE) .dep/*
416
-
417
-
410
+	@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); fi
411
+	$(REMOVE) $(TARGET).elf
418 412
 
419 413
 # Include the dependency files.
420 414
 -include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

+ 5
- 4
CubeFirmware/strings.c Переглянути файл

@@ -30,7 +30,7 @@ char stringVersion[] PROGMEM = "v2.3 Debug Build\nPROBABLY NOT COMPATIBLE WITH C
30 30
 char stringVersion[] PROGMEM = "v2.3 Release\n"; // 0
31 31
 #endif
32 32
 
33
-char stringInit[] PROGMEM = "\nInitialized: "; // 1
33
+char stringInit[] PROGMEM = "Initialized: "; // 1
34 34
 char stringSelfTestError[] PROGMEM = "Self-Test Error: 0b"; // 2
35 35
 char stringAudioError[] PROGMEM = " => No answer from Audio!\n"; // 3
36 36
 char stringMemError[] PROGMEM = " => No answer from Memory!\n"; // 4
@@ -69,10 +69,11 @@ char stringPowerOn[] PROGMEM = "Power-On Reset detected.\n"; // 36
69 69
 char stringMinute[] PROGMEM = "Yay! Another minute passed :)\n"; // 37
70 70
 char stringAudioMode[] PROGMEM = "Audio Mode!\n"; // 38
71 71
 char stringCubeMode[] PROGMEM = "Cube Mode!\n"; // 39
72
-char stringModeChange[] PROGMEM = "Cube mode changed!\n";
72
+char stringModeChange[] PROGMEM = "Cube mode entered!\n"; // 40
73
+char stringModeChange2[] PROGMEM = "Audio mode entered!\n"; // 41
73 74
 
74 75
 // Last index + 1
75
-#define STRINGNUM 41
76
+#define STRINGNUM 42
76 77
 
77 78
 PGM_P stringTable[STRINGNUM] PROGMEM = { stringVersion, stringSelfTestError, stringInit,
78 79
 								stringAudioError, stringMemError, stringMemWriteError,
@@ -84,7 +85,7 @@ PGM_P stringTable[STRINGNUM] PROGMEM = { stringVersion, stringSelfTestError, str
84 85
 								stringHelp9, stringInterrupts, stringFrames2, stringDeleted,
85 86
 								stringReset, stringWatchdog, stringBrownout, stringNothing,
86 87
 								stringExtern, stringJtag, stringPowerOn, stringMinute, stringAudioMode,
87
-								stringCubeMode, stringModeChange };
88
+								stringCubeMode, stringModeChange, stringModeChange2 };
88 89
 
89 90
 char stringNotFoundError[] PROGMEM = "String not found!\n";
90 91
 

+ 12
- 7
CubeFirmware/visualizer.c Переглянути файл

@@ -29,15 +29,20 @@
29 29
 
30 30
 void simpleVisualization(uint8_t *data) {
31 31
 	uint8_t *buff;
32
+	int8_t i, h, max, d;
32 33
 
33 34
 	buff = buffNew();
34
-	buffFillRect(buff, 0, data[0] / 31, 0, 0, 0, 7, 1);
35
-	buffFillRect(buff, 1, data[1] / 31, 0, 1, 0, 7, 1);
36
-	buffFillRect(buff, 2, data[2] / 31, 0, 2, 0, 7, 1);
37
-	buffFillRect(buff, 3, data[3] / 31, 0, 3, 0, 7, 1);
38
-	buffFillRect(buff, 4, data[4] / 31, 0, 4, 0, 7, 1);
39
-	buffFillRect(buff, 5, data[5] / 31, 0, 5, 0, 7, 1);
40
-	buffFillRect(buff, 6, data[6] / 31, 0, 6, 0, 7, 1);
35
+
36
+	for(i = 0; i < 7; i++) {
37
+		max = data[i] / 31;
38
+		
39
+		for (d = 0; d < 8; d++) {
40
+			for (h = 0; h < max; h++) {
41
+				buffSetPixel(buff, i, h, d);
42
+			}
43
+		}
44
+	}
45
+
41 46
 	setImage(buff);
42 47
 	buffFree(buff);
43 48
 }

Завантаження…
Відмінити
Зберегти