Skip to content

Commit eee490e

Browse files
authored
Merge pull request #21 from tobozo/unstable
Winter is coming!
2 parents c7beee8 + f2db9f5 commit eee490e

23 files changed

+2530
-715
lines changed

AmigaBall.h

+35-35
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
3030
*/
3131

32-
32+
extern const int AMIGABALL_YPOS;
3333

3434

3535
struct AmigaBallConfig {
3636
long Framelength = 25;
3737
byte Wires = 0; // 0 = no wireframes
38-
uint16_t BGColor = tft.color565(0x22, 0x22, 0x44);
39-
uint16_t YPos = 150;
38+
uint16_t BGColor = tft_color565(0x22, 0x22, 0x44);
39+
uint16_t YPos = AMIGABALL_YPOS;
4040
uint16_t XPos = 0;
41-
uint16_t Width = tft.width();
41+
uint16_t Width = scrollpanel_width();
4242
uint16_t Height = 132;
4343

4444
} amigaBallConfig;
@@ -83,29 +83,29 @@ class AmigaRulez {
8383
long lastTick = millis();
8484
long processTicks = 0;
8585

86-
uint16_t variableScale = Scale;
87-
uint16_t oldScale = Scale;
88-
uint16_t ScaleAmplitude = 8;
89-
uint16_t MaxScaleAmplitude;
90-
uint16_t TiltDeg = 17; // 17 degrees tilting to the right
91-
uint16_t LeftBoundary;
92-
uint16_t RightBoundary;
93-
uint16_t XPos;
94-
uint16_t YPos;
95-
uint16_t Width;
96-
uint16_t Height;
86+
float variableScale = Scale;
87+
float oldScale = Scale;
88+
float ScaleAmplitude = 8;
89+
float MaxScaleAmplitude;
90+
float TiltDeg = 17; // 17 degrees tilting to the right
91+
float LeftBoundary;
92+
float RightBoundary;
93+
float XPos;
94+
float YPos;
95+
float Width;
96+
float Height;
9797

98-
uint16_t VCentering;
99-
uint16_t Scale;
100-
uint16_t YPosAmplitude;
98+
float VCentering;
99+
float Scale;
100+
float YPosAmplitude;
101101
uint16_t BGColor;
102-
uint16_t lastPositionX;
103-
uint16_t lastPositionY;
104-
uint16_t positionX;
105-
uint16_t positionY;
102+
float lastPositionX;
103+
float lastPositionY;
104+
float positionX;
105+
float positionY;
106106

107107
void init( AmigaBallConfig conf=amigaBallConfig ) {
108-
BGColor = amigaBallConfig.BGColor;//tft.color565(0x22, 0x22, 0x44);
108+
BGColor = amigaBallConfig.BGColor;//tft_color565(0x22, 0x22, 0x44);
109109
Framelength = amigaBallConfig.Framelength;//33; // millis
110110
XPos = amigaBallConfig.XPos;
111111
YPos = amigaBallConfig.YPos;
@@ -175,7 +175,7 @@ class AmigaRulez {
175175
}
176176
}
177177

178-
float scaleTranslate(float s, uint16_t tx, uint16_t ty) {
178+
float scaleTranslate(float s, float tx, float ty) {
179179
for( int i=0; i<10; i++) {
180180
for( int j=0; j<9; j++ ) {
181181
float _x = points[i][j].x * s + tx;
@@ -186,7 +186,7 @@ class AmigaRulez {
186186
}
187187
}
188188

189-
void transform(float s, uint16_t tx, uint16_t ty) {
189+
void transform(float s, float tx, float ty) {
190190
tiltSphere( TiltRad );
191191
scaleTranslate( s, tx, ty );
192192
}
@@ -202,7 +202,7 @@ class AmigaRulez {
202202
}
203203
}
204204

205-
void clearCrescent(float r0, float r1, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) {
205+
void clearCrescent(float r0, float r1, float x0, float y0, float x1, float y1) {
206206
float vectorX = x1 - x0;
207207
float vectorY = y1 - y0;
208208
float vectAngleRadians = atan2(vectorY, vectorX); // angle in radians
@@ -215,10 +215,10 @@ class AmigaRulez {
215215
float h = sqrt( ( r0*r0 ) - ( a*a ) );
216216

217217
// circle intersection points
218-
uint16_t xx2 = 0; // x0 + a * vectorX / d;
219-
uint16_t yy2 = 0; // y0 + a * vectorY / d;
220-
uint16_t xx3 = 0; // x2 + h * vectorY / d; // also x3=x2-h*(y1-y0)/d;
221-
uint16_t yy3 = 0; // y2 - h * vectorX / d; // also y3=y2+h*(x1-x0)/d;
218+
float xx2 = 0; // x0 + a * vectorX / d;
219+
float yy2 = 0; // y0 + a * vectorY / d;
220+
float xx3 = 0; // x2 + h * vectorY / d; // also x3=x2-h*(y1-y0)/d;
221+
float yy3 = 0; // y2 - h * vectorX / d; // also y3=y2+h*(x1-x0)/d;
222222

223223
float mobAngleRadians = atan2(h, a);
224224
float angleRad0 = vectAngleRadians-mobAngleRadians;
@@ -232,10 +232,10 @@ class AmigaRulez {
232232
for( float angle=angleRad0-angleStep; angle<angleRad1+angleStep; angle+=angleStep ) {
233233
float ct = sin(angle);
234234
float st = cos(angle);
235-
uint16_t xx0 = x0 + st * r0;
236-
uint16_t yy0 = y0 + ct * r0;
237-
uint16_t xx1 = x1 + st * r1;
238-
uint16_t yy1 = y1 + ct * r1;
235+
float xx0 = x0 + st * r0;
236+
float yy0 = y0 + ct * r0;
237+
float xx1 = x1 + st * r1;
238+
float yy1 = y1 + ct * r1;
239239
if( xx2 != 0 && yy2 != 0 ) {
240240
tft.fillTriangle(xx0, yy0, xx1, yy1, xx2, yy2, BGColor );
241241
}
@@ -249,7 +249,7 @@ class AmigaRulez {
249249
}
250250
}
251251

252-
void draw(float phase, float scale, float oldscale, uint16_t x, uint16_t y) {
252+
void draw(float phase, float scale, float oldscale, float x, float y) {
253253
calcPoints( fmod(phase, phase8Rad) );
254254
transform(scale, x, y);
255255
if(lastPositionX!=0 && lastPositionY!=0) {

Assets.h

+53
Original file line numberDiff line numberDiff line change
@@ -1996,3 +1996,56 @@ const unsigned char gps_jpg[] /* 10x10 */= {
19961996
0x1d, 0x59, 0xce, 0x72, 0xff, 0xd9
19971997
};
19981998
const unsigned int gps_jpg_len = 954;
1999+
2000+
2001+
unsigned char uptime_jpg[] /* 12x12 */= {
2002+
0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01,
2003+
0x01, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43,
2004+
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2005+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2006+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2007+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2008+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2009+
0x01, 0x01, 0x01, 0x01, 0x01, 0xff, 0xdb, 0x00, 0x43, 0x01, 0x01, 0x01,
2010+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2011+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2012+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2013+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2014+
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
2015+
0x01, 0x01, 0xff, 0xc0, 0x00, 0x11, 0x08, 0x00, 0x0c, 0x00, 0x0c, 0x03,
2016+
0x01, 0x22, 0x00, 0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xc4, 0x00,
2017+
0x16, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2018+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x04, 0x09, 0xff, 0xc4, 0x00,
2019+
0x1e, 0x10, 0x00, 0x02, 0x03, 0x00, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00,
2020+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x04, 0x05, 0x08, 0x02,
2021+
0x03, 0x09, 0x01, 0x12, 0x16, 0xff, 0xc4, 0x00, 0x14, 0x01, 0x01, 0x00,
2022+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2023+
0x00, 0x00, 0x00, 0xff, 0xc4, 0x00, 0x14, 0x11, 0x01, 0x00, 0x00, 0x00,
2024+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2025+
0x00, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11,
2026+
0x00, 0x3f, 0x00, 0x92, 0x66, 0x75, 0xea, 0x38, 0xd4, 0x47, 0xe8, 0x35,
2027+
0xa3, 0x57, 0x0a, 0x66, 0x2f, 0xce, 0xaa, 0x68, 0xa3, 0x50, 0xc9, 0x77,
2028+
0xcf, 0x99, 0xde, 0x63, 0xd8, 0xdc, 0x1c, 0x2b, 0x40, 0x77, 0x65, 0x06,
2029+
0x4a, 0x85, 0x78, 0x90, 0x69, 0xb8, 0x38, 0xdb, 0x33, 0xb4, 0x47, 0x68,
2030+
0x1a, 0xe6, 0x49, 0x51, 0x65, 0xfd, 0xab, 0x83, 0xf8, 0x16, 0x7b, 0xc5,
2031+
0xbe, 0xb2, 0x2f, 0x4c, 0xa1, 0xfa, 0x34, 0x21, 0x70, 0xf3, 0xac, 0xd5,
2032+
0x3f, 0x8e, 0x6e, 0xe2, 0x2f, 0x38, 0x1e, 0x23, 0xf9, 0xdc, 0xf8, 0x95,
2033+
0xd4, 0xe1, 0x59, 0xba, 0xa6, 0x20, 0xea, 0xe0, 0xe8, 0xd1, 0xec, 0xdf,
2034+
0xe7, 0x22, 0x08, 0x6d, 0x73, 0xcd, 0xc9, 0x05, 0x9c, 0xd3, 0xe3, 0xdd,
2035+
0x27, 0xa8, 0x66, 0x8b, 0x5c, 0xe7, 0x55, 0xdd, 0x3c, 0xe8, 0xab, 0xbe,
2036+
0xc5, 0xdd, 0x14, 0x69, 0x6a, 0xf0, 0x0e, 0x03, 0x46, 0x83, 0x94, 0xc3,
2037+
0xcc, 0x72, 0x5e, 0x43, 0x4d, 0x73, 0x36, 0x3a, 0xe0, 0x19, 0xb0, 0xd3,
2038+
0x78, 0xa6, 0xa8, 0xd8, 0x80, 0x2a, 0xbd, 0x0c, 0x77, 0xb4, 0x3d, 0x19,
2039+
0x04, 0x96, 0xd3, 0x28, 0xa2, 0xdc, 0x95, 0x4a, 0x25, 0x4e, 0x91, 0xa2,
2040+
0x1f, 0x46, 0xa4, 0xf4, 0x3b, 0x86, 0x4d, 0x93, 0xb0, 0x84, 0xc5, 0x06,
2041+
0x08, 0x42, 0xaf, 0x2d, 0x92, 0xb5, 0x9d, 0x4c, 0xc0, 0x65, 0x19, 0xda,
2042+
0x89, 0xdd, 0xc4, 0xbd, 0x9e, 0x63, 0x4d, 0xca, 0xf2, 0xc3, 0xbf, 0x99,
2043+
0x4c, 0xdb, 0x19, 0xd6, 0x13, 0xe5, 0x8c, 0x2f, 0x6d, 0xb3, 0x12, 0xa3,
2044+
0x14, 0xec, 0xca, 0xfc, 0x92, 0x96, 0xaa, 0xec, 0xe9, 0x01, 0x44, 0xa5,
2045+
0x80, 0x68, 0xeb, 0xcb, 0x2f, 0x63, 0x51, 0x73, 0x65, 0x32, 0x27, 0x1c,
2046+
0xd9, 0x96, 0x38, 0x6d, 0x8c, 0x1b, 0x44, 0x03, 0x94, 0xa3, 0x55, 0x25,
2047+
0xc6, 0x71, 0x6c, 0x19, 0x3d, 0xe0, 0xf5, 0x17, 0x71, 0xc7, 0x69, 0xbe,
2048+
0x40, 0x5a, 0x06, 0x2f, 0x84, 0xbe, 0x45, 0xed, 0xe0, 0x33, 0xc2, 0x6c,
2049+
0xb0, 0xff, 0xd9
2050+
};
2051+
unsigned int uptime_jpg_len = 567;

0 commit comments

Comments
 (0)