Giter Site home page Giter Site logo

electricidea / dstike-ntp-wristwatch Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 7.0 7.89 MB

A simple ESP8266 wrist watch with WiFi connection for multiple locations, NTP time server synchronization and comparing functions.

License: MIT License

C++ 16.24% C 83.76%

dstike-ntp-wristwatch's People

Contributors

electricidea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dstike-ntp-wristwatch's Issues

`Time.h` and ambiguous call to `abs`

When trying to get this project to compile, I have encountered two main problems:

Time.h could not be found. This appears to be a Linux-only issue, as this is a problem with case-sensitivity. I was able to fix this by changing the line

#include <Time.h>

in main.cpp (at the time of writing this line 54) to

#include <time.h>

(notice the T now being a lowercase t.)

Another issue was that a call to abs in main.cpp was ambiguous. This could be an issue specific to my C++ compiler.
This was fixed by applying the changes specified in this pull request.

After fixing these two and switching to the PlatformIO CLI (the VS Code extension was having permission problems) I was able to compile and upload a build onto the watch.

I also want to thank you for writing this. I am planning on writing my own firmware for the watch, and this project is a sweet and simple example for the libraries and the setup to use, and until I wrote my own firmware my watch can actually tell the time now.

Build fails at 186, am I doing something wrong?

CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/nodemcuv2.html
PLATFORM: Espressif 8266 (3.1.0) > NodeMCU 1.0 (ESP-12E Module)
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:

  • framework-arduinoespressif8266 3.30001.210627 (3.0.1)
  • tool-esptool 1.413.0 (4.13)
  • tool-esptoolpy 1.30000.201119 (3.0.0)
  • toolchain-xtensa 2.100300.0 (10.3.0)
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 37 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 1.8.4
    |-- 4.1.0
    | |-- 1.0
    |-- 1.0
    |-- 1.0
    Building in release mode
    Compiling .pio\build\esp07\src\main.cpp.o
    src\main.cpp: In function 'void loop()':
    src\main.cpp:186:59: error: call of overloaded 'abs(long unsigned int)' is ambiguous
    186 | if(Watch.screenState && abs(displayOffTimer - millis()) > displayTimeout){
    | ^
    In file included from c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\cstdlib:75,
    from c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\stdlib.h:36,
    from C:\Users\macla.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Arduino.h:27,
    from src\main.cpp:28:
    c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\stdlib.h:74:5: note: candidate: 'int abs(int)'
    74 | int abs (int);
    | ^~~
    In file included from c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\cstdlib:77,
    from c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\stdlib.h:36,
    from C:\Users\macla.platformio\packages\framework-arduinoespressif8266\cores\esp8266/Arduino.h:27,
    from src\main.cpp:28:
    c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
    79 | abs(long double __x)
    | ^~~
    c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
    75 | abs(float __x)
    | ^~~
    c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
    71 | abs(double __x)
    | ^~~
    c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
    61 | abs(long long __x) { return __builtin_llabs (__x); }
    | ^~~
    c:\users\macla.platformio\packages\toolchain-xtensa\xtensa-lx106-elf\include\c++\10.3.0\bits\std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
    56 | abs(long __i) { return __builtin_labs(__i); }
    | ^~~
    src\main.cpp:241:41: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'time_t' {aka 'long long int'} [-Wformat=]
    241 | sprintf(TextBuffer, "--> %lds", (sysTime_now()+NTPdiffTime)-NTPTime);
    | ~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | | |
    | long int time_t {aka long long int}
    | %lld
    src\main.cpp: In function 'bool WiFi_connection(bool)':
    src\main.cpp:402:26: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
    402 | if(WIFI_location >= (sizeof(WiFI_Locations)/sizeof(WiFI_Locations[0]))){
    | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    *** [.pio\build\esp07\src\main.cpp.o] Error 1

Error Compiling platform.ini and main.cpp

This is my error Error: Invalid '/Users/riley/Downloads/DSTIKE-NTP-Wristwatch-master-3/platformio.ini' (project configuration file): 'While reading from '/Users/riley/Downloads/DSTIKE-NTP-Wristwatch-master-3/platformio.ini' [line 18]: option 'lib_deps' in section 'env:esp07' already exists

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.