Skip to content

Commit 422ed52

Browse files
committed
Revert "Issue fixes"
This reverts commit 4d3ef20.
1 parent 4d3ef20 commit 422ed52

File tree

4 files changed

+18
-39
lines changed

4 files changed

+18
-39
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ Libraries that don't rely on low-level access to AVR registers should work well.
213213
- [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)).
214214
- [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git)
215215
- [DHT11](https://github.com/adafruit/DHT-sensor-library) - Download latest v1.1.0 library and no changes are necessary. Older versions should initialize DHT as follows: ```DHT dht(DHTPIN, DHTTYPE, 15);```
216-
- [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager).
217-
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with esp8266. Use the "NeoPixelAnimator" branch for esp8266 to get HSL color support and more.
216+
- [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel libray, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager).
217+
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with esp8266.
218218
- [PubSubClient](https://github.com/Imroy/pubsubclient) MQTT library by @Imroy.
219219
- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with esp8266.
220220
- [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB.

hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_noniso.c

+15-24
Original file line numberDiff line numberDiff line change
@@ -149,58 +149,49 @@ char* ultoa(unsigned long value, char* result, int base) {
149149

150150
char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
151151

152-
if (isnan(number)) {
152+
if(isnan(number)) {
153153
strcpy(s, "nan");
154154
return s;
155155
}
156-
if (isinf(number)) {
156+
if(isinf(number)) {
157157
strcpy(s, "inf");
158158
return s;
159159
}
160160

161-
if (number > 4294967040.0 || number < -4294967040.0) {
161+
if(number > 4294967040.0 || number < -4294967040.0) {
162162
strcpy(s, "ovf");
163163
return s;
164164
}
165-
166165
char* out = s;
167-
int signInt_Part = 1;
168-
169166
// Handle negative numbers
170-
if (number < 0.0) {
171-
signInt_Part = -1;
167+
if(number < 0.0) {
168+
*out = '-';
169+
++out;
172170
number = -number;
173171
}
174172

175-
// calc left over digits
176-
if (prec > 0)
177-
{
178-
width -= (prec + 1);
179-
}
180-
181173
// Round correctly so that print(1.999, 2) prints as "2.00"
182174
double rounding = 0.5;
183-
for (uint8_t i = 0; i < prec; ++i)
175+
for(uint8_t i = 0; i < prec; ++i)
184176
rounding /= 10.0;
185177

186178
number += rounding;
187179

188180
// Extract the integer part of the number and print it
189-
unsigned long int_part = (unsigned long)number;
190-
double remainder = number - (double)int_part;
191-
out += sprintf(out, "%*ld", width, int_part * signInt_Part);
181+
unsigned long int_part = (unsigned long) number;
182+
double remainder = number - (double) int_part;
183+
out += sprintf(out, "%ld", int_part);
192184

193185
// Print the decimal point, but only if there are digits beyond
194-
if (prec > 0) {
186+
if(prec > 0) {
195187
*out = '.';
196188
++out;
189+
}
197190

198-
199-
for (unsigned char decShift = prec; decShift > 0; decShift--) {
200-
remainder *= 10.0;
201-
}
202-
sprintf(out, "%0*d", prec, (int)remainder);
191+
for (unsigned char decShift = prec; decShift > 0; decShift--) {
192+
remainder *= 10.0;
203193
}
194+
sprintf(out, "%0*d", prec, (int)remainder);
204195

205196
return s;
206197
}

hardware/esp8266com/esp8266/cores/esp8266/pgmspace.cpp

-11
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,6 @@ int printf_P(const char* formatP, ...) {
135135
return ret;
136136
}
137137

138-
int sprintf_P(char* str, const char* formatP, ...) {
139-
int ret;
140-
va_list arglist;
141-
va_start(arglist, formatP);
142-
143-
ret = vsnprintf_P(str, SIZE_IRRELEVANT, formatP, arglist);
144-
145-
va_end(arglist);
146-
return ret;
147-
}
148-
149138
int snprintf_P(char* str, size_t strSize, const char* formatP, ...) {
150139
int ret;
151140
va_list arglist;

hardware/esp8266com/esp8266/cores/esp8266/pgmspace.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ size_t strnlen_P(const char *s, size_t size);
5050
#define strlen_P(strP) strnlen_P((strP), SIZE_IRRELEVANT)
5151

5252
int printf_P(const char *formatP, ...) __attribute__ ((format (printf, 1, 2)));
53-
int sprintf_P(char *str, const char *formatP, ...) __attribute__((format(printf, 2, 3)));
54-
int snprintf_P(char *str, size_t strSize, const char *formatP, ...) __attribute__((format(printf, 3, 4)));
53+
int snprintf_P(char *str, size_t strSize, const char *formatP, ...) __attribute__ ((format (printf, 3, 4)));
5554
int vsnprintf_P(char *str, size_t strSize, const char *formatP, va_list ap) __attribute__ ((format (printf, 3, 0)));
5655

5756
// flash memory must be read using 32 bit aligned addresses else a processor

0 commit comments

Comments
 (0)