Skip to content

Commit 47ff21d

Browse files
Some minor example promotion cleanups
1 parent b7bb3e4 commit 47ff21d

File tree

10 files changed

+15
-15
lines changed

10 files changed

+15
-15
lines changed

libraries/BluetoothHIDMaster/examples/KeyboardPiano/KeyboardPiano.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void mb(void *cbdata, int butt, bool down) {
9191
inline uint32_t stepForHz(float hz) {
9292
const float stepHz = 1000.0 / 44100.0;
9393
const float step = hz * stepHz;
94-
return (uint32_t)(step * 65536.0);
94+
return (uint32_t)(step * 65536.0f);
9595
}
9696

9797
uint32_t keyStepMap[128]; // The frequency of any raw HID key

libraries/BluetoothHIDMaster/examples/KeyboardPianoBLE/KeyboardPianoBLE.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void mb(void *cbdata, int butt, bool down) {
9191
inline uint32_t stepForHz(float hz) {
9292
const float stepHz = 1000.0 / 44100.0;
9393
const float step = hz * stepHz;
94-
return (uint32_t)(step * 65536.0);
94+
return (uint32_t)(step * 65536.0f);
9595
}
9696

9797
uint32_t keyStepMap[128]; // The frequency of any raw HID key

libraries/LittleFS/examples/SpeedTest/SpeedTest.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ const char *rate(unsigned long start, unsigned long stop, unsigned long bytes) {
2121
strcpy_P(buff, PSTR("Inf b/s"));
2222
} else {
2323
unsigned long delta = stop - start;
24-
float r = 1000.0 * (float)bytes / (float)delta;
25-
if (r >= 1000000.0) {
26-
sprintf_P(buff, PSTR("%0.2f MB/s"), r / 1000000.0);
27-
} else if (r >= 1000.0) {
28-
sprintf_P(buff, PSTR("%0.2f KB/s"), r / 1000.0);
24+
float r = 1000.0f * (float)bytes / (float)delta;
25+
if (r >= 1000000.0f) {
26+
sprintf_P(buff, PSTR("%0.2f MB/s"), (double)r / 1000000.0);
27+
} else if (r >= 1000.0f) {
28+
sprintf_P(buff, PSTR("%0.2f KB/s"), (double)r / 1000.0);
2929
} else {
3030
sprintf_P(buff, PSTR("%d bytes/s"), (int)r);
3131
}

libraries/Mouse/examples/Circle/Circle.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void loop() {
1717
float r = 100;
1818
float ox = 0.0;
1919
float oy = 0.0;
20-
for (float a = 0; a < 2.0 * 3.14159; a += 0.1) {
20+
for (float a = 0.0f; a < 2.0f * 3.14159f; a += 0.1f) {
2121
float ax = r * cos(a);
2222
float ay = r * sin(a);
2323
float dx = ax - ox;

libraries/MouseAbsolute/examples/CircleAbsolute/CircleAbsolute.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void loop() {
1717
float r = 1000;
1818
for (float cx = 1000; cx <= 16000; cx += 4000) {
1919
for (float cy = 1000; cy <= 16000; cy += 4000) {
20-
for (float a = 0; a < 2.0 * 3.14159; a += 0.1) {
20+
for (float a = 0.0f; a < 2.0f * 3.14159f; a += 0.1f) {
2121
float ax = r * cos(a);
2222
float ay = r * sin(a);
2323
MouseAbsolute.move(ax + cx, ay + cy, 0);

libraries/MouseBT/examples/BTCircle/BTCircle.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void loop() {
1717
float r = 100;
1818
float ox = 0.0;
1919
float oy = 0.0;
20-
for (float a = 0; a < 2.0 * 3.14159; a += 0.1) {
20+
for (float a = 0.0f; a < 2.0f * 3.14159f; a += 0.1f) {
2121
float ax = r * cos(a);
2222
float ay = r * sin(a);
2323
float dx = ax - ox;

libraries/MouseBT/examples/BTCircleAbsolute/BTCircleAbsolute.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ void loop() {
1717
float r = 1000;
1818
for (float cx = 1000; cx <= 16000; cx += 4000) {
1919
for (float cy = 1000; cy <= 16000; cy += 4000) {
20-
for (float a = 0; a < 2.0 * 3.14159; a += 0.1) {
20+
for (float a = 0.0f; a < 2.0f * 3.14159f; a += 0.1f) {
2121
float ax = r * cos(a);
2222
float ay = r * sin(a);
2323
MouseBT.move(ax + cx, ay + cy, 0);

libraries/SD/examples/CardInfo/CardInfo.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void setup() {
137137
volumesize /= 1024;
138138
Serial.println(volumesize);
139139
Serial.print("Volume size (Gb): ");
140-
Serial.println((float)volumesize / 1024.0);
140+
Serial.println((float)volumesize / 1024.0f);
141141

142142
Serial.print("Card size: ");
143143
Serial.println((float)SD.size64() / 1000);

libraries/SingleFileDrive/examples/DataLoggerUSB/DataLoggerUSB.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void loop() {
8282
// Don't want the USB to connect during an update!
8383
File f = LittleFS.open("data.csv", "a");
8484
if (f) {
85-
f.printf("%lu,%lu,%f,%lu\n", cnt++, millis(), temp, hwrand);
85+
f.printf("%lu,%lu,%f,%lu\n", cnt++, millis(), (double)temp, hwrand);
8686
f.close();
8787
}
8888
}

libraries/lwIP_Ethernet/examples/EthernetLibCompatible/EthernetLibCompatible.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ void loop() {
118118
Serial.print("Received ");
119119
Serial.print(byteCount);
120120
Serial.print(" bytes in ");
121-
float seconds = (float)(endMicros - beginMicros) / 1000000.0;
121+
float seconds = (float)(endMicros - beginMicros) / 1000000.0f;
122122
Serial.print(seconds, 4);
123-
float rate = (float) byteCount / seconds / 1000.0;
123+
float rate = (float) byteCount / seconds / 1000.0f;
124124
Serial.print(", rate = ");
125125
Serial.print(rate);
126126
Serial.print(" kbytes/second");

0 commit comments

Comments
 (0)