Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid float-double-conversion #7559

Merged
merged 1 commit into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cores/esp8266/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ float Stream::parseFloat(char skipChar) {
boolean isFraction = false;
long value = 0;
int c;
float fraction = 1.0;
float fraction = 1.0f;

c = peekNextDigit();
// ignore non numeric leading characters
Expand All @@ -190,7 +190,7 @@ float Stream::parseFloat(char skipChar) {
else if(c >= '0' && c <= '9') { // is c a digit?
value = value * 10 + c - '0';
if(isFraction)
fraction *= 0.1;
fraction *= 0.1f;
}
read(); // consume the character we got with peek
c = timedPeek();
Expand Down
8 changes: 4 additions & 4 deletions libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,10 @@ WiFiPhyMode_t ESP8266WiFiGenericClass::getPhyMode() {
*/
void ESP8266WiFiGenericClass::setOutputPower(float dBm) {

if(dBm > 20.5) {
dBm = 20.5;
} else if(dBm < 0) {
dBm = 0;
if(dBm > 20.5f) {
dBm = 20.5f;
} else if(dBm < 0.0f) {
dBm = 0.0f;
}

uint8_t val = (dBm*4.0f);
Expand Down