Skip to content

Commit 2f0f1f6

Browse files
committed
Merge pull request #13 from pixelmatix/Aurora1.3
Merging Aurora1.3 to master
2 parents 5c8322b + bf98153 commit 2f0f1f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+11073
-8408
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
**/.DS_Store
2+
spec.d
3+
.ino.cpp
4+
Release
5+
Arduino
16
Debug
27
Visual Micro
38
*.suo
49
*.sdf
510
*.opensdf
611
*.vcxproj.filters
7-
*.vcxproj.user
12+
*.vcxproj.user
13+
/Release/
14+
.cproject
15+
.project
16+
.settings/

Animations.h

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
/*
2-
* Aurora: https://github.com/pixelmatix/aurora
3-
* Copyright (c) 2014 Jason Coon
4-
*
5-
* Portions of this code are adapted from Craig Lindley's LightAppliance: https://github.com/CraigLindley/LightAppliance
6-
* Copyright (c) 2014 Craig A. Lindley
7-
*
8-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
9-
* this software and associated documentation files (the "Software"), to deal in
10-
* the Software without restriction, including without limitation the rights to
11-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12-
* the Software, and to permit persons to whom the Software is furnished to do so,
13-
* subject to the following conditions:
14-
*
15-
* The above copyright notice and this permission notice shall be included in all
16-
* copies or substantial portions of the Software.
17-
*
18-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20-
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21-
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22-
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23-
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24-
*/
2+
* Aurora: https://github.com/pixelmatix/aurora
3+
* Copyright (c) 2014 Jason Coon
4+
*
5+
* Portions of this code are adapted from Craig Lindley's LightAppliance: https://github.com/CraigLindley/LightAppliance
6+
* Copyright (c) 2014 Craig A. Lindley
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
9+
* this software and associated documentation files (the "Software"), to deal in
10+
* the Software without restriction, including without limitation the rights to
11+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12+
* the Software, and to permit persons to whom the Software is furnished to do so,
13+
* subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in all
16+
* copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+
*/
2525

2626
#ifndef Animations_H
2727
#define Animations_H
2828

29+
extern GifPlayer gifPlayer;
30+
2931
class Animations : public Playlist {
3032
public:
3133

Attractor.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@
2424
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2525
*/
2626

27+
#include "Vector.h"
28+
2729
class Attractor {
2830
public:
2931
float mass; // Mass, tied to size
3032
float G; // Gravitational Constant
3133
PVector location; // Location
3234

3335
Attractor() {
34-
location = PVector((MATRIX_WIDTH / 2) - 1, (MATRIX_HEIGHT / 2) - 1);
36+
location = PVector(MATRIX_CENTRE_X, MATRIX_CENTRE_Y);
3537
mass = 10;
3638
G = .5;
3739
}
@@ -45,4 +47,4 @@ class Attractor {
4547
force *= strength; // Get force vector --> magnitude * direction
4648
return force;
4749
}
48-
};
50+
};

Aurora.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Aurora: https://github.com/pixelmatix/aurora
3+
* Copyright (c) 2014 Jason Coon
4+
*
5+
* Designed in collaboration with Pixelmatix using the SmartMatrix Library: http://pixelmatix.com
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
8+
* this software and associated documentation files (the "Software"), to deal in
9+
* the Software without restriction, including without limitation the rights to
10+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11+
* the Software, and to permit persons to whom the Software is furnished to do so,
12+
* subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23+
*/
24+
25+
#ifndef AURORA_H_
26+
#define AURORA_H_
27+
28+
#include <SmartMatrix_32x32.h>
29+
30+
const int MATRIX_CENTER_X = MATRIX_WIDTH / 2;
31+
const int MATRIX_CENTER_Y = MATRIX_HEIGHT / 2;
32+
33+
const byte MATRIX_CENTRE_X = MATRIX_CENTER_X - 1;
34+
const byte MATRIX_CENTRE_Y = MATRIX_CENTER_Y - 1;
35+
36+
void powerOff();
37+
void loadSettings();
38+
int getBrightnessLevel();
39+
int getBackgroundBrightnessLevel();
40+
void adjustBrightness(int delta);
41+
uint8_t cycleBrightness();
42+
void adjustBackgroundBrightness(int d);
43+
void boundBrightness();
44+
void boundBackgroundBrightness();
45+
void saveBrightnessSetting();
46+
void saveBackgroundBrightnessSetting();
47+
int loadIntSetting(char* dir, const char* settingPath, int maxLength, int defaultValue);
48+
void saveIntSetting(char* dir, const char* settingPath, int value);
49+
50+
51+
#endif

Aurora.ino

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include "Hardware.h"
2626

27+
#include "Aurora.h"
28+
2729
uint8_t brightness = 255;
2830
uint8_t backgroundBrightness = 63;
2931

@@ -37,9 +39,6 @@ uint8_t backgroundBrightnessMap[brightnessCount] = { 8, 16, 32, 64, 128 };
3739
#include <SPI.h>
3840
#include <SD.h>
3941

40-
const int MATRIX_CENTER_X = MATRIX_WIDTH / 2;
41-
const int MATRIX_CENTER_Y = MATRIX_HEIGHT / 2;
42-
4342
#include <Wire.h>
4443
#include <Time.h>
4544
#include <DS1307RTC.h>
@@ -76,6 +75,9 @@ bool isTimeAvailable = false;
7675
#include "ClockDigitalShort.h"
7776
ClockDigitalShort clockDigitalShort;
7877

78+
#include "ClockText.h"
79+
ClockText clockText;
80+
7981
#include "ClockDisplay.h"
8082
ClockDisplay clockDisplay;
8183

@@ -87,6 +89,9 @@ Animations animations;
8789

8890
#include "Bitmaps.h"
8991

92+
rgb24 menuColor = CRGB(CRGB::Blue);
93+
int autoPlayDurationSeconds = 10;
94+
9095
#include "MenuItem.h"
9196
#include "Menu.h"
9297
Menu menu;
@@ -97,14 +102,19 @@ Settings settings;
97102
#include "SettingsSetTime.h"
98103
#include "SettingsMoveClock.h"
99104

105+
#include "StreamingMode.h"
106+
StreamingMode streamingMode;
107+
100108
MenuItem menuItemPatterns = MenuItem("Patterns", &patterns);
101109
MenuItem menuItemAnimations = MenuItem("Animations", &animations);
110+
MenuItem menuItemStreamingMode = MenuItem("Streaming Mode", &streamingMode);
102111
MenuItem menuItemSettings = MenuItem("Settings", &settings);
103112

104113
// Main Menu
105114
MenuItem* mainMenuItems [] = {
106115
&menuItemPatterns,
107116
&menuItemAnimations,
117+
&menuItemStreamingMode,
108118
&menuItemSettings,
109119
};
110120

@@ -117,8 +127,8 @@ void setup()
117127
// Setup serial interface
118128
Serial.begin(9600);
119129

120-
//delay(3000);
121-
//Serial.println(F("starting..."));
130+
// delay(3000);
131+
// Serial.println(F("starting..."));
122132

123133
// Initialize the IR receiver
124134
irReceiver.enableIRIn();
@@ -170,6 +180,11 @@ void setup()
170180
if (enableStartupSplash) {
171181
while (matrix.getScrollStatus() != 0) {}
172182
}
183+
184+
if (!HAS_IR) {
185+
menu.playbackState = Menu::PlaybackState::Autoplay;
186+
menu.visible = false;
187+
}
173188
}
174189

175190
void loop()
@@ -207,6 +222,12 @@ void loadSettings() {
207222
boundBackgroundBrightness();
208223
matrix.setBackgroundBrightness(backgroundBrightness);
209224

225+
menuColor.red = loadIntSetting("/aurora/", "/aurora/menuR.txt", 3, 0);
226+
menuColor.green = loadIntSetting("/aurora/", "/aurora/menuG.txt", 3, 0);
227+
menuColor.blue = loadIntSetting("/aurora/", "/aurora/menuB.txt", 3, 255);
228+
229+
autoPlayDurationSeconds = loadIntSetting("/aurora/", "/aurora/autoplyd.txt", 3, 10);
230+
210231
clockDisplay.loadSettings();
211232
}
212233

@@ -244,11 +265,11 @@ void adjustBrightness(int delta) {
244265
brightness = brightnessMap[level];
245266
boundBrightness();
246267
matrix.setBrightness(brightness);
247-
saveBrightnessSetting();
248268
}
249269

250270
uint8_t cycleBrightness() {
251271
adjustBrightness(1);
272+
saveBrightnessSetting();
252273

253274
if (brightness == brightnessMap[0])
254275
return 0;
@@ -274,7 +295,6 @@ void adjustBackgroundBrightness(int d) {
274295
backgroundBrightness = backgroundBrightnessMap[level];
275296
boundBackgroundBrightness();
276297
matrix.setBackgroundBrightness(backgroundBrightness);
277-
saveBackgroundBrightnessSetting();
278298
}
279299

280300
void boundBrightness() {
@@ -299,6 +319,28 @@ void saveBackgroundBrightnessSetting() {
299319
saveIntSetting("/aurora/", "/aurora/bckbrght.txt", backgroundBrightness);
300320
}
301321

322+
void saveMenuColor() {
323+
saveMenuR();
324+
saveMenuG();
325+
saveMenuB();
326+
}
327+
328+
void saveMenuR() {
329+
saveIntSetting("/aurora/", "/aurora/menuR.txt", menuColor.red);
330+
}
331+
332+
void saveMenuG() {
333+
saveIntSetting("/aurora/", "/aurora/menuG.txt", menuColor.green);
334+
}
335+
336+
void saveMenuB() {
337+
saveIntSetting("/aurora/", "/aurora/menuB.txt", menuColor.blue);
338+
}
339+
340+
void saveAutoPlayDurationSeconds() {
341+
saveIntSetting("/aurora/", "/aurora/autoplyd.txt", autoPlayDurationSeconds);
342+
}
343+
302344
int loadIntSetting(char* dir, const char* settingPath, int maxLength, int defaultValue) {
303345
if (!sdAvailable)
304346
return defaultValue;
@@ -354,4 +396,14 @@ void saveIntSetting(char* dir, const char* settingPath, int value) {
354396
file.print(value, 10);
355397
file.close();
356398
}
357-
}
399+
}
400+
401+
// translates from x, y into an index into the LED array
402+
uint16_t XY(uint8_t x, uint8_t y) {
403+
if (y >= MATRIX_HEIGHT) { y = MATRIX_HEIGHT - 1; }
404+
if (y < 0) { y = 0; }
405+
if (x >= MATRIX_WIDTH) { x = MATRIX_WIDTH - 1; }
406+
if (x < 0) { x = 0; }
407+
408+
return (y * MATRIX_WIDTH) + x;
409+
}

Aurora.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.30723.0
4+
VisualStudioVersion = 12.0.31101.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Aurora", "Aurora.vcxproj", "{B0C98204-D78F-4B9E-AAB9-0A8453BB16EC}"
77
EndProject

0 commit comments

Comments
 (0)