Skip to content

Commit d78ba26

Browse files
committed
Add display test sketches
1 parent 4ee38b4 commit d78ba26

File tree

11 files changed

+459
-14
lines changed

11 files changed

+459
-14
lines changed

Firmware/Display/Display.ino

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,14 @@
33
44
Distributed as-is; no warranty is given.
55
*/
6-
#include <Wire.h> // Include Wire if you're using I2C
7-
#include <SFE_MicroOLED.h> // Include the SFE_MicroOLED library
6+
#include <Wire.h>
7+
#include <SFE_MicroOLED.h> //Click here to get the library: http://librarymanager/All#SparkFun_Micro_OLED
8+
#include "icons.h"
89

9-
#define PIN_RESET 9 // Connect RST to pin 9 (SPI & I2C)
10-
#define DC_JUMPER 1 // Set to either 0 (SPI, default) or 1 (I2C) based on jumper, matching the value of the DC Jumper
10+
#define PIN_RESET 9
11+
#define DC_JUMPER 1
1112
MicroOLED oled(PIN_RESET, DC_JUMPER);
1213

13-
uint8_t Battery_0 [] = {
14-
0xFF, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0x01,
15-
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x0B,
16-
0x0B, 0x0B, 0x08, 0x0F, 0x01, 0x01,
17-
};
18-
1914
bool displayDetected = false;
2015

2116
void setup()
@@ -48,12 +43,47 @@ void loop()
4843
{
4944
if (displayDetected)
5045
{
51-
oled.drawIcon(0, 0, 19, 16, Battery_0, sizeof(Battery_0), true);
46+
// oled.drawIcon(0, 0, Battery_3_Width, Battery_3_Height, Battery_3, sizeof(Battery_3), true);
47+
// oled.drawIcon(4, 4, Battery_1_Width, Battery_1_Height, Battery_1, sizeof(Battery_1), true);
48+
// oled.drawIcon(4, 4, Battery_0_Width, Battery_0_Height, Battery_0, sizeof(Battery_0), true);
49+
// oled.drawIcon(4, 4, Rover_Width, Rover_Height, Rover, sizeof(Rover), true);
50+
51+
oled.setFontType(1); //Set font to type 1: 8x16
52+
53+
//HPA
54+
// oled.setCursor(0, 21); //x, y
55+
// oled.print("HPA:");
56+
// oled.print("125");
57+
58+
//3D Mean Accuracy
59+
oled.setCursor(17, 19); //x, y: Squeeze against the colon
60+
oled.print(":12.1");
61+
62+
//SIV
63+
oled.setCursor(16, 35); //x, y
64+
oled.print(":24");
65+
66+
//Bluetooth Address
67+
oled.setFontType(0); //Set font to type 0:
68+
oled.setCursor(0, 4); //x, y
69+
oled.print("BC5D");
70+
71+
oled.drawIcon(45, 0, Battery_2_Width, Battery_2_Height, Battery_2, sizeof(Battery_2), true);
72+
oled.drawIcon(28, 0, Base_Width, Base_Height, Base, sizeof(Base), true);
73+
oled.drawIcon(0, 18, CrossHair_Width, CrossHair_Height, CrossHair, sizeof(CrossHair), true);
74+
oled.drawIcon(1, 35, Antenna_Width, Antenna_Height, Antenna, sizeof(Antenna), true);
5275
oled.display();
5376

54-
while(1);
77+
while (1);
5578
}
5679

80+
//Fix type
81+
//None
82+
//3D
83+
//RTK Fix
84+
//RTK Float
85+
//TIME - Base thing
86+
5787
Serial.print(".");
5888
delay(100);
5989
}

Firmware/Display/DisplayHelper.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
bool isConnected(uint8_t deviceAddress)
23
{
34
Wire.beginTransmission(deviceAddress);

Firmware/Display/icons.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
uint8_t CrossHair [] = {
2+
0x80, 0x80, 0xF0, 0x88, 0x84, 0x84, 0x84, 0x7F, 0x84, 0x84, 0x84, 0x88, 0xF0, 0x80, 0x80, 0x00,
3+
0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x7F, 0x10, 0x10, 0x10, 0x08, 0x07, 0x00, 0x00,
4+
};
5+
int CrossHair_Height = 15;
6+
int CrossHair_Width = 15;
7+
8+
uint8_t Antenna [] = {
9+
0x7E, 0xC3, 0x03, 0x06, 0x04, 0x0C, 0x18, 0x38, 0x7C, 0xCE, 0x84, 0x00, 0x00, 0x01, 0x1F, 0x1E,
10+
0x1C, 0x0C, 0x08, 0x08, 0x0C, 0x04, 0x07, 0x07,
11+
};
12+
int Antenna_Height = 13;
13+
int Antenna_Width = 12;
14+
15+
uint8_t Rover [] = {
16+
0x3C, 0x24, 0x64, 0xF4, 0xF7, 0x61, 0x21, 0x21, 0x21, 0x61, 0xF7, 0xF4, 0x64, 0x3C, 0x18,
17+
};
18+
int Rover_Height = 8;
19+
int Rover_Width = 15;
20+
21+
uint8_t Base [] = {
22+
0x00, 0xFF, 0x23, 0x13, 0x08, 0x88, 0x88, 0x88, 0x88, 0x08, 0x10, 0x20, 0xC0, 0x00, 0x0E, 0x09,
23+
0x08, 0x08, 0x08, 0x0F, 0x00, 0x00, 0x0F, 0x08, 0x08, 0x08, 0x09, 0x0E,
24+
};
25+
int Base_Height = 12;
26+
int Base_Width = 14;
27+
28+
uint8_t Battery_3 [] = {
29+
0xFF, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0x01,
30+
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x0B,
31+
0x0B, 0x0B, 0x08, 0x0F, 0x01, 0x01,
32+
};
33+
int Battery_3_Height = 12;
34+
int Battery_3_Width = 19;
35+
36+
uint8_t Battery_2 [] = {
37+
0xFF, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
38+
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x08,
39+
0x08, 0x08, 0x08, 0x0F, 0x01, 0x01,
40+
};
41+
int Battery_2_Height = 12;
42+
int Battery_2_Width = 19;
43+
44+
uint8_t Battery_1 [] = {
45+
0xFF, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
46+
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
47+
0x08, 0x08, 0x08, 0x0F, 0x01, 0x01,
48+
};
49+
int Battery_1_Height = 12;
50+
int Battery_1_Width = 19;
51+
52+
uint8_t Battery_0 [] = {
53+
0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
54+
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
55+
0x08, 0x08, 0x08, 0x0F, 0x01, 0x01,
56+
};
57+
int Battery_0_Height = 12;
58+
int Battery_0_Width = 19;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
bool isConnected(uint8_t deviceAddress)
3+
{
4+
Wire.beginTransmission(deviceAddress);
5+
if (Wire.endTransmission() == 0)
6+
return true;
7+
return false;
8+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
MicroOLED_Clock.ino
3+
4+
Distributed as-is; no warranty is given.
5+
*/
6+
#include <Wire.h>
7+
#include <SFE_MicroOLED.h> //Click here to get the library: http://librarymanager/All#SparkFun_Micro_OLED
8+
#include "icons.h"
9+
10+
#define PIN_RESET 9
11+
#define DC_JUMPER 1
12+
MicroOLED oled(PIN_RESET, DC_JUMPER);
13+
14+
bool displayDetected = false;
15+
16+
void setup()
17+
{
18+
Wire.begin();
19+
Wire.setClock(400000);
20+
21+
Serial.begin(115200);
22+
delay(100);
23+
Serial.println("OLED example");
24+
25+
//0x3D is default on Qwiic board
26+
if (isConnected(0x3D) == true || isConnected(0x3C) == true)
27+
{
28+
Serial.println("Display detected");
29+
displayDetected = true;
30+
}
31+
else
32+
Serial.println("No display detected");
33+
34+
if (displayDetected)
35+
{
36+
oled.begin(); // Initialize the OLED
37+
oled.clear(PAGE); // Clear the display's internal memory
38+
oled.clear(ALL); // Clear the library's display buffer
39+
}
40+
}
41+
42+
void loop()
43+
{
44+
if (displayDetected)
45+
{
46+
// oled.drawIcon(0, 0, Battery_3_Width, Battery_3_Height, Battery_3, sizeof(Battery_3), true);
47+
// oled.drawIcon(4, 4, Battery_1_Width, Battery_1_Height, Battery_1, sizeof(Battery_1), true);
48+
// oled.drawIcon(4, 4, Battery_0_Width, Battery_0_Height, Battery_0, sizeof(Battery_0), true);
49+
// oled.drawIcon(4, 4, Rover_Width, Rover_Height, Rover, sizeof(Rover), true);
50+
51+
oled.setFontType(1); //Set font to type 1: 8x16
52+
53+
//HPA
54+
// oled.setCursor(0, 21); //x, y
55+
// oled.print("HPA:");
56+
// oled.print("125");
57+
58+
//3D Mean Accuracy
59+
oled.setCursor(17, 19); //x, y: Squeeze against the colon
60+
oled.print(":12.1");
61+
62+
//SIV
63+
oled.setCursor(16, 35); //x, y
64+
oled.print(":24");
65+
66+
//Bluetooth Address
67+
oled.setFontType(0); //Set font to type 0:
68+
oled.setCursor(0, 4); //x, y
69+
oled.print("BC5D");
70+
71+
oled.drawIcon(45, 0, Battery_2_Width, Battery_2_Height, Battery_2, sizeof(Battery_2), true);
72+
oled.drawIcon(28, 0, Base_Width, Base_Height, Base, sizeof(Base), true);
73+
oled.drawIcon(0, 18, CrossHair_Width, CrossHair_Height, CrossHair, sizeof(CrossHair), true);
74+
oled.drawIcon(1, 35, Antenna_Width, Antenna_Height, Antenna, sizeof(Antenna), true);
75+
oled.display();
76+
77+
while (1);
78+
}
79+
80+
//Fix type
81+
//None
82+
//3D
83+
//RTK Fix
84+
//RTK Float
85+
//TIME - Base thing
86+
87+
Serial.print(".");
88+
delay(100);
89+
}

Firmware/Display_Base/icons.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
uint8_t CrossHair [] = {
2+
0x80, 0x80, 0xF0, 0x88, 0x84, 0x84, 0x84, 0x7F, 0x84, 0x84, 0x84, 0x88, 0xF0, 0x80, 0x80, 0x00,
3+
0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x7F, 0x10, 0x10, 0x10, 0x08, 0x07, 0x00, 0x00,
4+
};
5+
int CrossHair_Height = 15;
6+
int CrossHair_Width = 15;
7+
8+
uint8_t Antenna [] = {
9+
0x7E, 0xC3, 0x03, 0x06, 0x04, 0x0C, 0x18, 0x38, 0x7C, 0xCE, 0x84, 0x00, 0x00, 0x01, 0x1F, 0x1E,
10+
0x1C, 0x0C, 0x08, 0x08, 0x0C, 0x04, 0x07, 0x07,
11+
};
12+
int Antenna_Height = 13;
13+
int Antenna_Width = 12;
14+
15+
uint8_t Rover [] = {
16+
0x3C, 0x24, 0x64, 0xF4, 0xF7, 0x61, 0x21, 0x21, 0x21, 0x61, 0xF7, 0xF4, 0x64, 0x3C, 0x18,
17+
};
18+
int Rover_Height = 8;
19+
int Rover_Width = 15;
20+
21+
uint8_t Base [] = {
22+
0x00, 0xFF, 0x23, 0x13, 0x08, 0x88, 0x88, 0x88, 0x88, 0x08, 0x10, 0x20, 0xC0, 0x00, 0x0E, 0x09,
23+
0x08, 0x08, 0x08, 0x0F, 0x00, 0x00, 0x0F, 0x08, 0x08, 0x08, 0x09, 0x0E,
24+
};
25+
int Base_Height = 12;
26+
int Base_Width = 14;
27+
28+
uint8_t Battery_3 [] = {
29+
0xFF, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0x01,
30+
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x0B,
31+
0x0B, 0x0B, 0x08, 0x0F, 0x01, 0x01,
32+
};
33+
int Battery_3_Height = 12;
34+
int Battery_3_Width = 19;
35+
36+
uint8_t Battery_2 [] = {
37+
0xFF, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
38+
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x08,
39+
0x08, 0x08, 0x08, 0x0F, 0x01, 0x01,
40+
};
41+
int Battery_2_Height = 12;
42+
int Battery_2_Width = 19;
43+
44+
uint8_t Battery_1 [] = {
45+
0xFF, 0x01, 0xFD, 0xFD, 0xFD, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
46+
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
47+
0x08, 0x08, 0x08, 0x0F, 0x01, 0x01,
48+
};
49+
int Battery_1_Height = 12;
50+
int Battery_1_Width = 19;
51+
52+
uint8_t Battery_0 [] = {
53+
0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
54+
0x0F, 0x08, 0xF8, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
55+
0x08, 0x08, 0x08, 0x0F, 0x01, 0x01,
56+
};
57+
int Battery_0_Height = 12;
58+
int Battery_0_Width = 19;

Firmware/Display_Icon/Display_Icon.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ uint8_t truck [] = {
3232
};
3333

3434
int iconHeight = 17;
35-
int iconWidth = 20;
35+
int iconWidth = 19;
3636

3737
bool displayDetected = false;
3838

@@ -79,6 +79,8 @@ void loop()
7979
oled.drawIcon(iconX, iconY, iconWidth, iconHeight, truck, sizeof(truck), true);
8080
oled.display();
8181

82+
while(1);
83+
8284
//Move the icon
8385
iconX += iconXChangeAmount;
8486
iconY += iconYChangeAmount;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
bool isConnected(uint8_t deviceAddress)
3+
{
4+
Wire.beginTransmission(deviceAddress);
5+
if (Wire.endTransmission() == 0)
6+
return true;
7+
return false;
8+
}

0 commit comments

Comments
 (0)