radimkeseg / esp8266-NeoPixel-Clock

Neopixel Cuckoo Alarm Clock
5 stars 1 forks source link

There are some errors when building with arduino ide #5

Open liuyunx opened 4 years ago

liuyunx commented 4 years ago

Arduino:1.8.12 (Windows 10), 开发板:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

sketch\TimeClient.cpp: In member function 'long int TimeClient::getCurrentEpochWithUtcOffset()':

TimeClient.cpp:124:67: error: invalid operands of types 'double' and 'long int' to binary 'operator%'

return round(getCurrentEpoch() + 3600 * myUtcOffset + 86400L) % 86400L;

                                                               ^

esp8266-NeoPixel-Clock:63:12: error: 'Clock clock' redeclared as different kind of symbol

Clock clock(&strip, 30);

        ^

In file included from C:\Users\feiry\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3/tools/sdk/libc/xtensa-lx106-elf/include/stdlib.h:11:0,

             from C:\Users\feiry\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\cores\esp8266/Arduino.h:27,

             from D:\esp8266-NeoPixel-Clock-master\esp8266-NeoPixel-Clock\esp8266-NeoPixel-Clock.ino:20:

C:\Users\feiry\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3/tools/sdk/libc/xtensa-lx106-elf/include/../include/time.h:50:19: error: previous declaration of 'clock_t clock()'

clock_t _EXFUN(clock, (void));

               ^

C:\Users\feiry\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3/tools/sdk/libc/xtensa-lx106-elf/include/_ansi.h:65:30: note: in definition of macro '_EXFUN'

define _EXFUN(name, proto) name proto

                          ^

D:\esp8266-NeoPixel-Clock-master\esp8266-NeoPixel-Clock\esp8266-NeoPixel-Clock.ino: In function 'void handle_store_settings()':

esp8266-NeoPixel-Clock:125:9: error: request for member 'SetTimeOffset' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

clock.SetTimeOffset(cs.settings.UTC_OFFSET+cs.settings.DST);

     ^

D:\esp8266-NeoPixel-Clock-master\esp8266-NeoPixel-Clock\esp8266-NeoPixel-Clock.ino: In function 'void setup()':

esp8266-NeoPixel-Clock:176:9: error: request for member 'SetTimeOffset' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

clock.SetTimeOffset(cs.settings.UTC_OFFSET+cs.settings.DST);

     ^

D:\esp8266-NeoPixel-Clock-master\esp8266-NeoPixel-Clock\esp8266-NeoPixel-Clock.ino: In function 'void loop()':

esp8266-NeoPixel-Clock:215:12: error: request for member 'getHourInt' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

if(clock.getHourInt() == cs.settings.alarmHour && clock.getMinsInt() == cs.settings.alarmMins){

        ^

esp8266-NeoPixel-Clock:215:59: error: request for member 'getMinsInt' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

if(clock.getHourInt() == cs.settings.alarmHour && clock.getMinsInt() == cs.settings.alarmMins){

                                                       ^

esp8266-NeoPixel-Clock:221:12: error: request for member 'getMinsInt' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

if(clock.getMinsInt() == 0 && clock.getSecsInt()<10){

        ^

esp8266-NeoPixel-Clock:221:39: error: request for member 'getSecsInt' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

if(clock.getMinsInt() == 0 && clock.getSecsInt()<10){

                                   ^

esp8266-NeoPixel-Clock:231:14: error: request for member 'getHourInt' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

 if(clock.getHourInt()>=22 || clock.getHourInt()<6) strip.setBrightness(cs.settings.brightness_night);

          ^

esp8266-NeoPixel-Clock:231:40: error: request for member 'getHourInt' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

 if(clock.getHourInt()>=22 || clock.getHourInt()<6) strip.setBrightness(cs.settings.brightness_night);

                                    ^

esp8266-NeoPixel-Clock:235:11: error: request for member 'Show' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

 clock.Show(clear, clear); delay(10);

       ^

D:\esp8266-NeoPixel-Clock-master\esp8266-NeoPixel-Clock\esp8266-NeoPixel-Clock.ino: In function 'void updateData()':

esp8266-NeoPixel-Clock:247:9: error: request for member 'SetTimeOffset' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

clock.SetTimeOffset(cs.settings.UTC_OFFSET+cs.settings.DST);

     ^

esp8266-NeoPixel-Clock:248:9: error: request for member 'SetUp' in 'clock', which is of non-class type 'clock_t() {aka long unsigned int()}'

clock.SetUp(ITimer::hex2rgb(

     ^

exit status 1 invalid operands of types 'double' and 'long int' to binary 'operator%'

blanchloup22 commented 3 years ago

Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

I have the same errors

try changing return round(getCurrentEpoch() + 3600 * myUtcOffset + 86400L) % 86400L; to return fmod(round(getCurrentEpoch() + 3600 * myUtcOffset + 86400L), 86400L);` That cleared the error in TimeClient.cpp

I am working on the rest

ag60 commented 3 years ago

To solve this ERROR: "esp8266-NeoPixel-Clock:63:12: error: 'Clock clock' redeclared as different kind of symbol" change all "clock" references in esp8266-NeoPixel-Clock to someting else like "pxlclock" SO. Line 63 Clock pxlclock(&strip, 30); Line 125 pxlclock.SetTimeOffset(cs.settings.UTC_OFFSET+cs.settings.DST);

as example. than it works for me.