Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

restore dtostrf when floats are disabled in printf/scanf + round fix#7093

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
devyte merged 7 commits intoesp8266:masterfromd-a-v:dtostrfix2
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
NextNext commit
fix with proposal per review
  • Loading branch information
@d-a-v
d-a-v committedFeb 19, 2020
commitc646c7ea05aa5f536c403ca9054d3e3bf1d95e6c
26 changes: 12 additions & 14 deletionscores/esp8266/core_esp8266_noniso.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,9 +41,18 @@ char* ultoa(unsigned long value, char* result, int base) {
return utoa((unsigned int)value, result, base);
}

#ifdef NOPRINTFLOAT

char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
if (!_printf_float) {
return __dtostrf(number, width, prec, s);
} else {
char fmt[32];
sprintf(fmt, "%%%d.%df", width, prec);
sprintf(s, fmt, number);
return s;
}
}

static char * __dtostrf(double number, signed char width, unsigned char prec, char *s) {
bool negative = false;

if (isnan(number)) {
Expand DownExpand Up@@ -87,7 +96,7 @@ char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
digitcount++;
}

// minimal compensation for possible lack of precision
// minimal compensation for possible lack of precision (#7087 addition)
number *= 1 + std::numeric_limits<decltype(number)>::epsilon();

number /= tenpow;
Expand DownExpand Up@@ -120,15 +129,4 @@ char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
return s;
}

#else // !NOPRINTFLOAT

char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
char fmt[32];
sprintf(fmt, "%%%d.%df", width, prec);
sprintf(s, fmt, number);
return s;
}

#endif // !NOPRINTFLOAT

};
5 changes: 2 additions & 3 deletionsplatform.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,6 @@ build.stdcpp_lib=-lstdc++
build.stdcpp_level=-std=gnu++11

build.float=-u _printf_float -u _scanf_float
build.floatflags=
build.led=

# default SDK for all boards
Expand All@@ -54,7 +53,7 @@ compiler.libc.path={runtime.platform.path}/tools/sdk/libc/xtensa-lx106-elf
compiler.cpreprocessor.flags=-D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ "-I{compiler.sdk.path}/include" "-I{compiler.sdk.path}/{build.lwip_include}" "-I{compiler.libc.path}/include" "-I{build.path}/core"

compiler.c.cmd=xtensa-lx106-elf-gcc
compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.floatflags}
compiler.c.flags=-c {compiler.warning_flags} -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags}

compiler.S.cmd=xtensa-lx106-elf-gcc
compiler.S.flags=-c -g -x assembler-with-cpp -MMD -mlongcalls
Expand All@@ -65,7 +64,7 @@ compiler.c.elf.cmd=xtensa-lx106-elf-gcc
compiler.c.elf.libs=-lhal -lphy -lpp -lnet80211 {build.lwip_lib} -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 {build.stdcpp_lib} -lm -lc -lgcc

compiler.cpp.cmd=xtensa-lx106-elf-g++
compiler.cpp.flags=-c {compiler.warning_flags} -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 {build.stdcpp_level} -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags} {build.floatflags}
compiler.cpp.flags=-c {compiler.warning_flags} -Os -g -mlongcalls -mtext-section-literals -fno-rtti -falign-functions=4 {build.stdcpp_level} -MMD -ffunction-sections -fdata-sections {build.exception_flags} {build.sslflags}

compiler.as.cmd=xtensa-lx106-elf-as

Expand Down
1 change: 0 additions & 1 deletiontools/boards.txt.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1588,7 +1588,6 @@ def all_boards ():

if nofloat:
print(id + '.build.float=')
print(id + '.build.floatflags=-DNOPRINTFLOAT')

print('')

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp