Giter Site home page Giter Site logo

sharandac / my-ttgo-watch Goto Github PK

View Code? Open in Web Editor NEW
523.0 53.0 247.0 141.99 MB

A GUI named hedge for smartwatch like devices based on ESP32. Currently support for T-Watch2020 (V1,V2,V3), T-Watch2021, M5Paper, M5Core2 and native Linux support for testing.

License: GNU General Public License v2.0

C++ 1.58% C 98.37% HTML 0.01% Shell 0.01% Python 0.01% Ruby 0.01% PHP 0.03%
esp32 ttgo watch smartwatch twatch webserver iot-device my-ttgo-watch m5paper m5stack-fire

my-ttgo-watch's Introduction

   


My-TTGO-Watch

A GUI named hedge for smartwatch like devices based on ESP32. Currently support for T-Watch2020 (V1,V2,V3), T-Watch2021 (V1 and V2, no ota-updates), M5Paper, M5Core2, WT32-SC01 and native Linux support for testing.

Features

  • BLE communication

  • Time synchronization via BLE

  • Notification via BLE

  • Step counting

  • Wake-up on wrist rotation

  • Quick actions:

    • WiFi
    • Bluetooth
    • GPS
    • Luminosity
    • Sound volume
  • Multiple watch faces:

  • Multiple 'apps':

    • Music (control the playback of the music on your phone)
    • Navigation (displays navigation instructions coming from the companion app)
    • Map (displays a map)
    • Notification (displays the last notification received)
    • Stopwatch (with all the necessary functions such as play, pause, stop)
    • Alarm
    • Step counter (displays the number of steps and daily objective)
    • Weather
    • Calendar
    • IR remote
    • ...
  • Companion apps: Gadgetbridge

Install

Clone this repository and open it with platformIO. Select the right env and then build and upload. Or follow the great step by step tutorial from ShotokuTech.

Please check out

/**
* change here your network for first use if WPS noch work
*/
if( !wifictl_is_known( "foo" ) )
wifictl_insert_network( "foo", "bar" );
}
to setup your wifi when wps or input via display is not possible.

If you are interested in native Linux support, please install sdl2, curl and mosquitto dev lib and change the env to emulator_* in platformIO.

sudo apt-get install libsdl2-dev libcurl4-gnutls-dev libmosquitto-dev build-essential

Known issues

  • the webserver crashes the ESP32 really often
  • the battery indicator is not accurate, rather a problem with the power management unit ( axp202 )

Development on the Windows platform

The development tools have a known issue with the size of the project on Windows platforms. When the program is built you may receive the following error:

xtensa-esp32-elf-g++: error: CreateProcess: No such file or directory
*** [.pio\build\t-watch2020-v1\firmware.elf] Error 1

This issue has not been seen on Linux or other platforms. This is a linker issue and can be fixed by removing apps. To remove unneeded apps you can simply delete the appropriate directory in /src/app. Then simply recompile. App can be added in the same way. But note that the app must support autocall_function . This allows the automatic integration of apps without touching the rest of the code ( the magic behind autocall_function ).

Since each app includes a different set of files, you may need to delete several apps to reduce it small enough for the Windows build.

How to use

Cf. Usage

Forks that are recommended

Pickelhaupt
FantasyFactory
NorthernDIY
linuxthor
d03n3rfr1tz3
lunokjod

For the programmers

Cf. contribution guide
app autocall function the magic behind autocall_function or add a app without touching the rest

Interface

TTGO T-Watch 2020

screenshot screenshot screenshot screenshot screenshot screenshot screenshot screenshot screenshot screenshot screenshot screenshot

M5Paper ( downscaled )

screenshot screenshot screenshot

M5Core2

screenshot screenshot screenshot screenshot

WT32-SC01

screenshot screenshot screenshot

TTGO T-Watch 2021

screenshot screenshot screenshot

Contributors

Special thanks to the following people for their help:

5tormChild
bwagstaff
chrismcna
datacute
fliuzzi02
guyou
jakub-vesely
joshvito
JoanMCD
NorthernDIY
Neuroplant
paulstueber
pavelmachek
rnisthal
ssspeq

and the following projects:

ArduinoJson
AsyncTCP
ESP32SSDP
ESP32-targz
ESP8266Audio
ESPAsyncWebServer
LVGL
NimBLE-Arduinoh2zero/NimBLE-Arduino
pubsubclient
TinyGPSPlus
TFT_eSPI
TTGO_TWatch_Library

Every Contribution to this repository is highly welcome! Don't fear to create pull requests which enhance or fix the project, you are going to help everybody.

If you want to donate to the author then you can buy me a coffee.

my-ttgo-watch's People

Contributors

5tormchild avatar ajvreugdenhil avatar bwagstaff avatar calebe94 avatar chrismcna avatar d03n3rfr1tz3 avatar datacute avatar dervomsee avatar dicamarques14 avatar fliuzzi02 avatar gdv0 avatar guyou avatar jakub-vesely avatar joshvito avatar lesykm avatar neuroplant avatar northerndiy avatar paulstueber avatar pavelmachek avatar rnisthal avatar sharandac avatar ssspeq avatar tearran avatar w4b-zero avatar wfdudley avatar zenflow 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  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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

my-ttgo-watch's Issues

Weird battery percentage

Two days before the battery percentage was just right after two charging cycles using calculated battery percentage. (97% is pretty close to what I call a full charge.)
But in one of the previous builds what was 70%, now it displays 592% instead of 70%:
"designed cap: 300mAh, charged capacity: 1776.0mAh. battery voltage: 3.68V"
If I turn calculated battery percentage off, it displays 17%, which is far from the reality.

Reboots

Since the last update (2020081307) I am getting really much reboots.
Seems to appear everytime when the WLAN has connected.
If I disable WiFi it is getting better.

Build error (Windows): The command line is too long.

After updating to the latest sources, since last Friday, and trying to upload, I get the error message The command line is too long.
Environment: Windows 10, VSCode & platformio (all with latest updates)
Tried the build and upload actions from the Pio menu in VSCode.

Moving the source folder closer to C:\ hasn't solved the issue.

NB: The OTA update of version 2020080702 doesn't seem to do anything...

HTTPS - Free memory to low

Hi,

im trying to compete a https get request but i get the error below.
[E][ssl_client.cpp:33] _handle_error(): [start_ssl_client():190]: (-32512) SSL - Memory allocation failed
[E][WiFiClientSecure.cpp:132] connect(): start_ssl_client: -32512

Im using master with the code below, ive tried increasing the "Stack size in words" but either i still get the same error or the task fails. The https request works fine in a stand alone program

TaskHandle_t _test_Task;
void test_Task( void * pvParameters ) {
Serial.println("enter_example_app_event_cb");
Serial.println(ESP.getFreeHeap());

        HTTPClient http;
        http.useHTTP10( true );
        http.begin("https://*********"); //Specify the URL
        http.addHeader("Authorization","*******");
        int httpCode = http.GET();  
    
        if (httpCode != 200 ) { 
            static const char * btns[] ={"Close", ""};

            lv_obj_t * msgBox = lv_msgbox_create(lv_scr_act(), NULL);
            lv_msgbox_set_text(msgBox, "Failed");
            lv_msgbox_add_btns(msgBox, btns);
            lv_obj_set_width(msgBox, 200);
            lv_obj_align(msgBox, NULL, LV_ALIGN_CENTER, 0, 0);
        }
    

        http.end(); //Free the resources

        vTaskDelete( NULL );

}

static void enter_example_app_event_cb( lv_obj_t * obj, lv_event_t event ) {
switch( event ) {
case( LV_EVENT_CLICKED ):

        xTaskCreate(    test_Task,      /* Function to implement the task */
            "example Task",    /* Name of the task */
            5000,                            /* Stack size in words */
            NULL,                            /* Task input parameter */
            1,                               /* Priority of the task */
            &_test_Task );  /* Task handle. */ 

        
        break;
}    

}

make the watch less energy consuming

I found several solutions to make the watch much less energy consuming:
on powermgm.cpp change the function as is :

void powermgm_loop(TTGOClass *ttgo)
{

// event-tripper pmu-button or pmu-battery state change
if (powermgm_get_event(POWERMGM_PMU_BUTTON | POWERMGM_PMU_BATTERY | POWERMGM_BMA_WAKEUP | POWERMGM_SILENCE_WAKEUP_REQUEST | POWERMGM_STANDBY_REQUEST))
{

    // if we have an request when we are in silence mode, emulate an wakeup from standby
    if (powermgm_get_event(POWERMGM_SILENCE_WAKEUP) && powermgm_get_event(POWERMGM_PMU_BUTTON | POWERMGM_PMU_BATTERY | POWERMGM_BMA_WAKEUP))
    {
        powermgm_set_event(POWERMGM_STANDBY);
        powermgm_clear_event(POWERMGM_SILENCE_WAKEUP);
    }

    if (powermgm_get_event(POWERMGM_STANDBY))
    {
        powermgm_clear_event(POWERMGM_STANDBY);
        ttgo->power->setDCDC3Voltage(3300);
        // normal wake up from standby
        if (powermgm_get_event(POWERMGM_PMU_BUTTON | POWERMGM_PMU_BATTERY | POWERMGM_BMA_WAKEUP))
        {
            log_i("wakeup");
            display_go_wakeup(ttgo);
            motor_vibe(1);
        }
        // silence wakeup request from standby
        else if (powermgm_get_event(POWERMGM_SILENCE_WAKEUP_REQUEST))
        {
            log_i("silence wakeup");
            display_go_silence_wakeup(ttgo);
            powermgm_set_event(POWERMGM_SILENCE_WAKEUP);
        }
        timesyncToSystem();
        ttgo->startLvglTick();
        mainbar_jump_to_maintile(LV_ANIM_OFF);
        lv_disp_trig_activity(NULL);
        if (bma_get_config(BMA_STEPCOUNTER))
            ttgo->bma->enableStepCountInterrupt(true);
        //wifictl_on();                                         // for stopping the wifi on each time you switch on your watch
        ttgo->power->clearTimerStatus();
        ttgo->power->offTimer();

        // doing loop                                          // Adding loop management ONLY if the watch is switched on
        pmu_loop(ttgo);
        bma_loop(ttgo);
        display_loop(ttgo);
    }
    else
    {
        log_i("go to standby");
        display_go_sleep(ttgo);
        timesyncToRTC();
        if (powermgm_get_event(POWERMGM_WIFI_ACTIVE)) wifictl_off();
        while (powermgm_get_event(POWERMGM_WIFI_ACTIVE | POWERMGM_WIFI_CONNECTED | POWERMGM_WIFI_OFF_REQUEST | POWERMGM_WIFI_ON_REQUEST | POWERMGM_WIFI_SCAN))
        {
            yield();
        }
        ttgo->stopLvglTick();
        if (bma_get_config(BMA_STEPCOUNTER))
            ttgo->bma->enableStepCountInterrupt(false);
        powermgm_set_event(POWERMGM_STANDBY);
        powermgm_clear_event(POWERMGM_SILENCE_WAKEUP);
        ttgo->power->setDCDC3Voltage(3000);
        ttgo->power->clearTimerStatus();
        ttgo->power->setTimer(60);
        setCpuFrequencyMhz(10);
        gpio_wakeup_enable((gpio_num_t)AXP202_INT, GPIO_INTR_LOW_LEVEL);
        gpio_wakeup_enable ((gpio_num_t)BMA423_INT1, GPIO_INTR_HIGH_LEVEL);
        esp_sleep_enable_gpio_wakeup();
        esp_light_sleep_start();
    }
    // clear event
    powermgm_clear_event(POWERMGM_PMU_BUTTON | POWERMGM_PMU_BATTERY | POWERMGM_BMA_WAKEUP | POWERMGM_STANDBY_REQUEST | POWERMGM_SILENCE_WAKEUP_REQUEST);
}
else {                                                       // and if the watch is switched ON (not off !)
    pmu_loop(ttgo);
    bma_loop(ttgo);
    display_loop(ttgo);
}

}

we really have a real gain on energy consumption ... One more thing ... in the TTGO T-Watch 2020 the battery is 380mA ... not 300mA

Config files in a text format e.g JSON

I tried out downloading and editing the weather config file. Then I discovered that the plain struct is written to the file, so it isn't possible to edit it in a text editor.
Any kind of serialization format which allows to read and modify config data would help with clock set-up.
Maybe ArduinoJSON could be used?

PR: web pages (index, info, network, frameset, ... )

HI, based on the work from bwagstaff I:

  • Enhance info page
  • Create network information page
  • Move index.htm to c-code (for now) to provide it faster to all users by the well working update
    (and add /network link) - better design will follow :)

@bwagstaff I hope it's OK

Also, it's a nice collection of ESP32 functions :-)

Install:

  • add following code to webserver.c ( replace asyncserver.on("/info" .... ){} )
  asyncserver.on("/index.htm", HTTP_GET, [](AsyncWebServerRequest *request) {
    String html = (String) "<!DOCTYPE html>"
      "<html>"
      "<frameset cols=\"300, *\">"
      "<frame src=\"/nav.htm\" name=\"nav\">"
      "<frame name=\"cont\">"
      "</frameset>"
      "</html>";
    request->send(200, "text/html", html);
  });

asyncserver.on("/nav.htm", HTTP_GET, [](AsyncWebServerRequest *request) {
    String html = (String) "<!DOCTYPE html>"
      "<html><head>"
      "<meta http-equiv='Content-type' content='text/html; charset=utf-8'>"
      "<title>Web Interface</title>"
      "</head><body>"
      "<h1>TTGo Watch Web Server</h1>"
      "<p>This is your device, program it as you see fit."
      "<p>Here are some URLs the device already supports, which you might find helpful:"
      "<ul>"
      "<li><a target=\"cont\" href=\"/info\">/info</a> - Display information about the device"
      "<li><a target=\"cont\" href=\"/network\">/network</a> - Display network information"
      "<li><a target=\"cont\" href=\"/shot\">/shot</a> - Capture a screen shot"
      "<li><a target=\"cont\" href=\"/screen.565\">/screen.565</a> - Retrieve the image in RGB565 format"
      "<li><a target=\"_blank\" href=\"/edit\">/edit</a> - View, edit, upload, and delete files"
      "</ul>"
      "<p><div style=\"color:red;\">Caution:</div> Use these with care:"
      "<ul><li><a target=\"cont\"  href=\"/reset\">/reset</a> Reboot the device"
      "<li><a target=\"_top\" href=\"/update\">/update</a> Transmit a firmware update through POST request"
      "</body></html>";
    request->send(200, "text/html", html);
  });


  asyncserver.on("/info", HTTP_GET, [](AsyncWebServerRequest *request) {
    FlashMode_t mode = ESP.getFlashChipMode();
    int SketchFull = ESP.getSketchSize() + ESP.getFreeSketchSpace();

    String html = (String) "<html><head><meta charset=\"utf-8\"></head><body><h3>Information</h3>" +
                  "<b><u>Memory</u></b><br>" +
                  "<b>Heap size: </b>" + MemFormat(ESP.getHeapSize()) + "<br>" +
                  "<b>Heap free: </b>" + MemFormat(ESP.getFreeHeap()) + "<br>" +
                  "<b>Heap free min: </b>" + MemFormat(ESP.getMinFreeHeap()) + "<br>" +
                  "<b>Heap size: </b>" + MemFormat(ESP.getHeapSize()) + "<br>" +
                  "<b>Psram size: </b>" + MemFormat(ESP.getPsramSize()) + "<br>" +
                  "<b>Psram free: </b>" + MemFormat(ESP.getFreePsram()) + "<br>" +

                  "<br><b><u>System</u></b><br>" +
                  "\t<b>Battery voltage: </b>" + TTGOClass::getWatch()->power->getBattVoltage() / 1000 + " Volts" + "<br>" +

                  "\t<b>Uptime: </b>" + time_str( millis() / 1000 ) + "<br>" +
                  "<br><b><u>Chip</u></b>" +
                  "<br><b>SdkVersion: </b>" + String(ESP.getSdkVersion()) + "<br>" +
                  "<b>CpuFreq: </b>" + String(ESP.getCpuFreqMHz()) + " MHz<br>" +
                  
                  "<br><b><u>Flash</u></b><br>" +
                  "<b>FlashChipSpeed: </b>" + String(ESP.getFlashChipSpeed() / 1000000) + " MHz<br>" +
                  "<b>Flash mode: </b>" + String( mode == FM_QIO ? "QIO" : mode == FM_QOUT ? "QOUT" : mode == FM_DIO ? "DIO" : mode == FM_DOUT ? "DOUT" : "UNKNOWN") + "</b><br>" +
                  "<b>Flash sector size: </b>" + String( SPI_FLASH_SEC_SIZE) + "<br>" +
                  "<b>FlashChipMode: </b>" + ESP.getFlashChipMode() + "<br>" +
                  "<b>FlashChipSize (SDK): </b>" + MemFormat(ESP.getFlashChipSize()) + "<br>" +
                  
                  "<br><b><u>Firmware</u></b><br>" +
                  "<b>SketchSpace free: </b>" + MemFormat(ESP.getFreeSketchSpace()) + " (" + (ESP.getFreeSketchSpace() / (SketchFull / 100)) + "%)<br>" +
                  "<b>BuildTime: </b>" +  __DATE__ + " " + __TIME__  + "<br>" +
                  "<b>Version: </b>" + __FIRMWARE__ + "<br>" +
                  "<b>GCC-Version: </b>" + __VERSION__ + "<br>" +
                  "<b>SketchMD5: </b>" + String(ESP.getSketchMD5()) + "<br>" +
                  
                  "<br><b><u>Filesystem</u></b><br>" +
                  "<b>Total size: </b>" + MemFormat(SPIFFS.totalBytes()) + "<br>" +
                  "<b>Used size: </b>" + MemFormat(SPIFFS.usedBytes()) + "<br>" +

                  "<br>";
    request->send(200, "text/html", html);
  });

  asyncserver.on("/network", HTTP_GET, [](AsyncWebServerRequest *request) {
    FlashMode_t mode = ESP.getFlashChipMode();
    int SketchFull = ESP.getSketchSize() + ESP.getFreeSketchSpace();
    char PHYmode[] = {'B', 'G', 'N'};
    String html = (String) "<html><head><meta charset=\"utf-8\"></head><body><h3>Network</h3>" +
                  "<b>IP Addr: </b>" + WiFi.localIP().toString() + "<br>" +
                  "<b>MAC: </b>" + WiFi.macAddress() + "<br>" +
                  "<b>SNMask: </b>" + WiFi.subnetMask().toString() + "<br>" +
                  "<b>GW IP: </b>" + WiFi.gatewayIP().toString() + "<br>" +
                  "<b>DNS 1: </b>" + WiFi.dnsIP(0).toString() + "<br>" +
                  "<b>DNS 2: </b>" + WiFi.dnsIP(1).toString() + "<br>" +
                  "<b>RSSI: </b>" + String(WiFi.RSSI()) + "dB<br>" +
                  "<b>Hostname: </b>" + WiFi.getHostname() + "<br>" +
                  "<b>SSID: </b>" + WiFi.SSID() + "<br>" +
                  "<br>Upnp Info: <a target=\"_blank\" href='/description.xml'>description.xml</a>" + "<br>" +
                  "</body></head></html>";
    request->send(200, "text/html", html);
  });
  • remove index.htm (not the favicon) from data if exists

update:

  • change the default location of index.htm
  asyncserver.rewrite("/", "/index.htm"); //index.htm im c-code
  asyncserver.serveStatic("/", SPIFFS, "/");//.setDefaultFile("index.htm"); //index.htm in SPIFSS

regards, Joe

Firmware wont compile

Trying to compile with arduino IDE.
This error occurs:

Arduino: 1.8.13 (Linux), Board: "TTGO T-Watch, Enabled, Default (2 x 6.5 MB app, 3.6 MB SPIFFS), 2000000, None"

sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x50): undefined reference to motor_setup()' sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x54): undefined reference to display_setup(TTGOClass*)'
sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x58): undefined reference to screenshot_setup()' sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x5c): undefined reference to splash_screen_stage_one(TTGOClass*)'
sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x60): undefined reference to splash_screen_stage_update(char const*, int)' sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x64): undefined reference to powermgm_setup(TTGOClass*)'
sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x68): undefined reference to splash_screen_stage_finish(TTGOClass*)' sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x6c): undefined reference to gui_setup()'
sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x70): undefined reference to display_get_brightness()' sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z4loopv+0x0): undefined reference to gui_loop(TTGOClass*)'
sketch/my-ttgo-watch.ino.cpp.o:(.literal._Z4loopv+0x4): undefined reference to powermgm_loop(TTGOClass*)' sketch/my-ttgo-watch.ino.cpp.o: In function setup()':
/home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:24: undefined reference to motor_setup()' /home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:31: undefined reference to display_setup(TTGOClass*)'
/home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:33: undefined reference to screenshot_setup()' /home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:35: undefined reference to splash_screen_stage_one(TTGOClass*)'
/home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:36: undefined reference to splash_screen_stage_update(char const*, int)' /home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:38: undefined reference to splash_screen_stage_update(char const*, int)'
/home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:40: undefined reference to splash_screen_stage_update(char const*, int)' /home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:44: undefined reference to splash_screen_stage_update(char const*, int)'
/home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:46: undefined reference to splash_screen_stage_update(char const*, int)' /home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:47: undefined reference to powermgm_setup(TTGOClass*)'
/home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:48: undefined reference to splash_screen_stage_update(char const*, int)' /home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:49: undefined reference to splash_screen_stage_finish(TTGOClass*)'
/home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:51: undefined reference to gui_setup()' /home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:54: undefined reference to display_get_brightness()'
sketch/my-ttgo-watch.ino.cpp.o: In function loop()': /home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:63: undefined reference to gui_loop(TTGOClass*)'
/home/user1/Arduino/Watch/my-ttgo-watch/my-ttgo-watch.ino:64: undefined reference to `powermgm_loop(TTGOClass*)'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board TTGO T-Watch.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

App guidelines

starting from stopwatch and weather I'm trying to develop my first twatch "app";

Apps (APPNAME, replace it with what you like) must be included in main file my-ttgo-watch.ino
thru #include "app/APPNAME/APPNAME.h"
then adding a setup function APPNAME_setup(); in the arduino setup() function

the APPNAME_setup( void ) function basically will create the gui thru the lvgl library, read the json config file, then wil do some other initialization

#ifdef APPNAME_WIDGET will enable some other functions (more than mere icon show in main tile, but I've not yet understood)

This is the little I understand :D

Events handling are due by callback functions. Most of them are related to lvgl, but which "system events"or hooks we can handle ? For example, what I have to do to handle a custom message not handled by bluetooth_message_msg_pharse() or override it's handling ?

So, there is some visual editor for the lvgl gui ?
What are the guidelines for developing an App that correctly interact whith the framework "My-ttgo-watch" ?

TTGO Watch 2020 hard reboots on connecting to Wifi (core 0 panic)

T-watch 2020 hard reboots every time it connects to Wifi.
It appears to successfully sync RTC, as the time changes and the RTC sync message is output to Serial.
Serial Monitor Displays the following:

syncToRtc: 120 7 24 - 12 54 11 
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x4000142d  PS      : 0x00060a30  A0      : 0x800d5f9d  A1      : 0x3ffe1a80
A2      : 0x3ffc1a6d  A3      : 0x00000000  A4      : 0x000000ff  A5      : 0x0000ff00
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x00000000  A9      : 0x00000000
A10     : 0x3ffc1a6d  A11     : 0x3f450164  A12     : 0x00000000  A13     : 0x3ffe16d0
A14     : 0x3ffe18d0  A15     : 0x00000001  SAR     : 0x00000020  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x4000142d  LEND    : 0x4000143a  LCOUNT  : 0xffffffff

Backtrace: 0x4000142d:0x3ffe1a80 0x400d5f9a:0x3ffe1a90 0x400d4bcb:0x3ffe2ad0 0x4008d59d:0x3ffe2af0

Rebooting...

and then the usual bootup sequence...
I don't think the RTC sync is causing the issue, as it still occurs when this is disabled.

Using with T-Watch 2020

First, my many thanks for the work you have put into this firmware. I've done a successful upload to my T-Watch 2020, but I found the line in config.h "To use T-Watch2020, please uncomment this line". I've tried uncommenting just that line or the whole block of code but then get errors when building:

.pio/libdeps/ttgo-t-watch/TTGO TWatch Library/src/LilyGoWatch.h:177:2: error: #error "Please define Watch model"
#error "Please define Watch model"

Just wondering if that is expected behavior. Any guidance would be appreciated!

Timezone resets to utc-0 after sleep

If I connect to wifi with rtc update enabled, the time shows properly. Currently, I'm -4 utc. It shows 10:52. If I sleep and wake the device, it shows 06:52 until I reconnect wifi.

missing /My-TTGO-Watch/include

He issue I'm having is with the watch not displaying the battery charge level and it keeps updating randomly here and there and resets. I was checking the code and its missing the include file or folder.
"/Users/username/Documents/PlatformIO/Projects/My-TTGO-Watch/include".

Error in build

Hi,

I have loaded the project into PlatformIO and when I try to build it, I get the following :

Executing task: C:\Users\Dominique HUGO.platformio\penv\Scripts\platformio.exe run <

Processing ttgo-t-watch (platform: espressif32; board: ttgo-t-watch; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
WindowsError: [Error 183] Cannot create a file when that file already exists: 'C:\DISK_C\_OneDrive\Arduino\Lilygo\My-TTGO-Watch-master\.pio\build\ttgo-t-watch':
File "C:\users\dominique hugo.platformio\penv\lib\site-packages\platformio\builder\main.py", line 155:
makedirs(env.subst("$BUILD_DIR"))
File "c:\users\dominique hugo.platformio\penv\lib\os.py", line 157:
mkdir(name, mode)
============================================= [FAILED] Took 181.81 seconds =============================================
The terminal process "C:\Users\Dominique HUGO.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.


and if I try to "upload", I get :

Building in release mode
Compiling .pio\build\ttgo-t-watch\libc15\TTGO TWatch Library\Adafruit_GFX.cpp.o
Compiling .pio\build\ttgo-t-watch\libc15\TTGO TWatch Library\BBQ10Keyboard.cpp.o
Compiling .pio\build\ttgo-t-watch\libc15\TTGO TWatch Library\MPR121.cpp.o
Compiling .pio\build\ttgo-t-watch\libc15\TTGO TWatch Library\TFT_eSPI\Fonts\Font16.c.o
:0:10: warning: ISO C99 requires whitespace after the macro name
:0:10: warning: ISO C++11 requires whitespace after the macro name
:0:10: warning: ISO C++11 requires whitespace after the macro name
:0:10: warning: ISO C++11 requires whitespace after the macro name
Compiling .pio\build\ttgo-t-watch\libc15\TTGO TWatch Library\TFT_eSPI\Fonts\Font32rle.c.o
:0:10: warning: ISO C99 requires whitespace after the macro name
Compiling .pio\build\ttgo-t-watch\libc15\TTGO TWatch Library\TFT_eSPI\Fonts\Font64rle.c.o
:0:10: warning: ISO C99 requires whitespace after the macro name
In file included from .pio\libdeps\ttgo-t-watch\TTGO TWatch Library\src\BBQ10Keyboard.cpp:5:0:
.pio\libdeps\ttgo-t-watch\TTGO TWatch Library\src\BBQ10Keyboard.h:3:18: fatal error: Wire.h: No such file or directory



compilation terminated.
In file included from .pio\libdeps\ttgo-t-watch\TTGO TWatch Library\src\MPR121.cpp:29:0:
.pio\libdeps\ttgo-t-watch\TTGO TWatch Library\src\MPR121.h:5:18: fatal error: Wire.h: No such file or directory



compilation terminated.
*** [.pio\build\ttgo-t-watch\libc15\TTGO TWatch Library\BBQ10Keyboard.cpp.o] Error 1
*** [.pio\build\ttgo-t-watch\libc15\TTGO TWatch Library\MPR121.cpp.o] Error 1
============================================== [FAILED] Took 22.19 seconds ==============================================
The terminal process "C:\Users\Dominique HUGO.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

I have change nothing in code, same .ini downloaded from github
can you advice please ?
thanks in advance,
sincerly,
Domi.

Update not working

Hi!

Got watch today, updated to current version from this git using platformio (factory version did not have update function yet).
Wifi works (I can get weather data).
But updating only says update failed, and no message on the console.

Any thoughts?

Information Request: How to get started

I'm an experienced web app coder, and want to get started working on software for this watch.
I'd love to be able to contribute changes/features to this code base in the future.

I had a few questions about getting started.

  1. Is there a explanation of how to use the web server on the watch to push code updates?
  2. Also, is there a way to emulate the software running on the watch on my pc, to speed up development? I built and uploaded the software onto the watch and it took a bit.
  3. Maybe a wiki page on here to explain theses things would be helpful?
  4. Any debugging tips? e.g. Can I attach a debugger to the software on the watch?

Thanks.

Swipes don't start from weather icon

Hi!

With the current version, swipes seem to be quite poor, they only trigger with trying a lot.
The keyboard is pretty good, so accuracy seems fine.

It's especially annoying trying to get from the main screen down, since it triggers the weather configuration all the time instead :)
Is there any trick? :) Fast/slow, where to start/end? Do you recognize this, or could it be a hardware issue?

I know the firmware is new, just letting you know :)

timezone setting resets to zero on reboot

The first two toggles on the time setting screen persist after a reboot, but the timezone must be reset each time I reboot.
I am using a timezone setting of -5.

Is this expected or a bug.

Return icon and vibration feedback

The return function, this means back from setups to pages is difficult to use and requires often 3 to 5 times tapping on it.
Perhaps the tapping area is very small to hit ?
The vibration feedback should be switchable.

I´m looking forward to new features and I must say a great "Thank you"!!!!
At the moment I´m learning to get in C++ programming and have admit how difficult it is .

Greetings from Aachen

Christopher

Should sound be ok?

Hi!

On watch start it seems to try and play a sound.
For me it's very soft and very not nice sounding.

Is that a known issue, or could I have a hardware issue?

Thanks! :)

Keyboard too small

Just recieved my T-Watch 2020.
After seraching for documentation, I found this page and updated to this firmware.
Now the touchscreen keyboard is too small.
I can't do anything.

missing include

He issue I'm having is with the watch not displaying the battery charge level and it keeps updating randomly here and there and resets. I was checking the code and its missing the include file or folder.
"/Users/username/Documents/PlatformIO/Projects/My-TTGO-Watch/include".

Strange power readings

Hi! I have some strange power readings. Voltage seems to be good, i measured battery with multimeter. Sometimes it shows "?" in statusbar instead of 0%.I had this bug on older firmware too. Sometimes, when i connect watch to PC "0%" resets to a number that seems legit for current VBat but never shows 100% no matter how long i will charge it. VBat tho can be around 4.2V. And i can go with 0% all day...

read

2020072706

Anyone have this bug?
Sorry for photo, i cant take screenshots yet :(

update server / repo

Hi, from which server / git repo the updates are managed ?

Here the last change is 3 days old and the version is 2020080405.
My watch updates frequently (>ones per day) and the version shows 202008061 oh... 1/2h later 202008062 !?!

The device knows my wifi settings - I want to know which software is running.

Elex

General questions

Hi Dirk!
First, I want to thank you all for this great piece of software, which is an amazing starting point ... but a start to go where? I believe that everyone's desire could be to develop a useful framework.

Wish List: (not in order of importance or feasibility)

  1. Bluetooth notification system: it is really the minimum for a smartwatch
  2. a system for downloadable / installable "Apps". It is difficult to think of pre-compiled binaries linked at runtime, we would need a real operating system capable of dynamically allocating them, protecting memory, managing multitasking ... it's unrealistic, but a microscripting system would be interesting instead ! Micropython uses too many resources, but maybe an implementation of esp8266basic could allow the creation of small "apps" downloadable as source.
    A further alternative could be to implement a "web app" system: a sort of lvgl dialog interpreter defined by a json readed via http would be enough, which could act as a sort of "form" whose result is sent back via http post. All the application logic would be processed server side, leaving ttwatch just to render the interface.
  3. a more practical or at least more reliable way to manage the filesystem would be needed. Okay via http, the ideal would be a fat via usb.

What do you think ?

Personally, I would like to work on some "apps" (based on example_app to work in the current "framework")

  1. a simple vnc client
  2. a simple widget of a value (of your choice) taken from an OBDII wifi interface
  3. one button to control some smart relays
  4. time and days between now an a selectable date/time

recompiling: foot_16px undefined reference

compiling the latest source leads to:
Linking .pio/build/ttgo-t-watch/firmware.elf
.pio/build/ttgo-t-watch/src/gui/statusbar.cpp.o:(.literal._Z15statusbar_setupv+0x68): undefined reference to `foot_16px'

PR: FW update by browser

An alternative way to update if the *.bin file is on the same PC as your browser and all in the same LAN.

Here the Update work local. You can download the .bin file from Github to your PC and flash it from here.

20200807_192 168 1 247_update_000167
.
.
.
20200807_192 168 1 247_update_000168

Info:
There are two /update URLs on the server. The new one acts on HTTP GET, the existing acts on POST. The existing system is untouched !
In Browser the html page gets delivered by the GET, the FW file is send to the POST.

For now - uses external JS library from googleapis.com

Sometimes all is OK, also if the page priints an error !

Install:

-replace
asyncserver.on( "/update", HTTP_POST, ... });
by the following block.

  //UPDATE_VIA_BROWSER
  static const char* serverIndex =
    "<!DOCTYPE html>\n <html><head>\n <script src='https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script>"
    "\n <script src='/jquery.min.js'></script>"

    "\n <style>"
    "\n #progressbarfull {"
    "\n background-color: #20201F;"
    "\n border-radius: 20px;"
    "\n width: 320px;"
    "\n padding: 4px;"
    "\n}"
    "\n #progressbar {"
    "\n background-color: #20CC00;"
    "\n width: 3%;"
    "\n height: 16px;"
    "\n border-radius: 10px;"
    "\n}"
    "\n</style>"
    "\n </head><body>"
    "<h2>Update by Browser</h2>"
    "\n <form method='POST' action='#' enctype='multipart/form-data' id='upload_form'>"
    "\n <input type='file' name='update'>"
    "\n <br><br><input type='submit' value='Update'>"
    "\n </form>"
    "\n <div id='prg'>Progress: 0%</div>"
    "\n <div id=\"progressbarfull\"><div id=\"progressbar\"></div></div>"
    "\n <script>"
    "\n $('form').submit(function(e){"
    "\n e.preventDefault();"
    "\n var form = $('#upload_form')[0];"
    "\n var data = new FormData(form);"
    "\n $.ajax({"
    "\n url: '/update',"
    "\n type: 'POST',"
    "\n data: data,"
    "\n contentType: false,"
    "\n processData:false,"
    "\n xhr: function() {"
    "\n var xhr = new window.XMLHttpRequest();"
    "\n xhr.upload.addEventListener('progress', function(evt) {"
    "\n if (evt.lengthComputable) {"
    "\n var per = evt.loaded / evt.total;"
    "\n document.getElementById(\"prg\").innerHTML = 'Progress: ' + Math.round(per*100) + '%';"
    "\n document.getElementById(\"progressbar\").style.width=Math.round(per*100)+ '%';"
    "}"
    "}, false);"
    "return xhr;"
    "},"
    "\n success:function(d, s) {"
    "\n document.getElementById(\"prg\").innerHTML = 'Progress: success';"
    "\n console.log('success!')"
    "},"
    "\n error: function (a, b, c) {"
    "\n document.getElementById(\"prg\").innerHTML = 'Progress: error';"
    "}"
    "});"
    "});"
    "\n </script>"
    "\n </body></html>";

  //update by GET request -> by browser
  asyncserver.on("/update", HTTP_GET, [](AsyncWebServerRequest * request) {
    request->send(200, "text/html", serverIndex);
  });

  //update by POST upload
  asyncserver.on(
      "/update", HTTP_POST,
      [](AsyncWebServerRequest *request) {},
      [](AsyncWebServerRequest *request, const String &filename, size_t index, uint8_t *data, size_t len, bool final) { handleUpdate(request, filename, index, data, len, final); });

check, that the line in nav.htm code contains >_top<
"<li><a target=\"_top\" href=\"/update\">/update</a> Transmit a firmware update through POST request"

Have Fun
Joe

WiFi turning off at the "wrong" time

Would it be a good idea to prevent WiFi-Connection from shutting down during editing files through the webserver ?
Don´t know if that same issue happens during other actions (updating, etc.)
Greetings
Christopher

Big battery overcharge !

Hello, after several charging / discharging of the battery ... I find myself with a battery charged to more than 140% (412.2mAh) while the manufacturer maximum is 300 to 380 mAh.

can´t compile

Tried to build and upload.

Error is :
collect2.exe: error: ld returned 1 exit status

What can I do ?

Screen is reversed

Hi,

it seems that my screen is rotated by 180 deg ! :-(

image

any idea ?
Thanks,
Domi.

Switch for motor vibe off

I could switch it off by commenting out a line at touch.cpp:
motor_vibe( 1 );

Now I tried out the update functionality and the annoying vibe us back again. Would be cool if it could be switched off at the display settings.

Starter questions.

Thanks all for the nice work on the TTGO Watch2020 software.
I have some simple questions as a starter:

  • How to change the background of the watch?
  • Are there different themes available?

Scrolled notifications

When a notification from my phone is shown, and it requires scrolling to read it... If the text area is scrolled to the bottom, and a new short notification arrives, the scrolling is not reset to the top, and the start of the new notification cannot be seen (until I scroll up).

TileView Scrolling

Ive noticed that dragging a button doesnt drag the view tile, for example going to settings tile hold power then drag and behaviour doesn't work correctly. This was an issue I had in some of my initial code (but yours is better so have dropped it), I noticed that the official example didn't have this problem.

Its something to do with the imgbtn where as the official example uses just an img but still use lv_obj_set_event_cb and handle the click event. The img could be clicked or dragged to move the tile view.

I will look into this issue and attempt to resolve over the next few days

Hard Code Wifi credentials

Hello,

First of all i wanna say congratz for the great firmware you have developed. Im a starter but it is definitely a good starting point. Amazing work!

I'm used to Arduino general settings of Wifi... Just provide ssid and psk and do WiFi.Begin... But as a beginner , the wifictl code seems a little tricky for me :(
Can you help me hard code my credentials to instead of start scanning, connect to my SSID ?
I added WiFi.Begin(ssid,password) to wifictl.cpp wifictl_on(), but it didnt worked as expected, since there are some other functions from this wifictl module that conflicts with WiFi.

Thanks

Error in link

Hi,

I try to compile to project, the compilation was fine but I get errors in link

`

my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x50): undefined reference to motor_setup()' my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x54): undefined reference to display_setup(TTGOClass*)'
my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x58): undefined reference to screenshot_setup()' my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x5c): undefined reference to splash_screen_stage_one(TTGOClass*)'
my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x60): undefined reference to splash_screen_stage_update(char const*, int)' my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x64): undefined reference to powermgm_setup(TTGOClass*)'
my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x68): undefined reference to gui_setup()' my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x6c): undefined reference to weather_app_setup()'
my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x70): undefined reference to stopwatch_app_setup()' my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x74): undefined reference to example_app_setup()'
my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x78): undefined reference to wifictl_on()' my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x7c): undefined reference to splash_screen_stage_finish(TTGOClass*)'
my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x80): undefined reference to display_get_brightness()' my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x84): undefined reference to display_set_brightness(unsigned int)'
my-ttgo-watch.ino.cpp.o:(.literal._Z5setupv+0x88): undefined reference to blectl_setup()' my-ttgo-watch.ino.cpp.o:(.literal._Z4loopv+0x0): undefined reference to gui_loop(TTGOClass*)'
my-ttgo-watch.ino.cpp.o:(.literal._Z4loopv+0x4): undefined reference to powermgm_loop(TTGOClass*)' my-ttgo-watch.ino.cpp.o: In function setup()':
my-ttgo-watch.ino:51: undefined reference to motor_setup()' my-ttgo-watch.ino:51: undefined reference to display_setup(TTGOClass*)'
my-ttgo-watch.ino:53: undefined reference to screenshot_setup()' my-ttgo-watch.ino:56: undefined reference to splash_screen_stage_one(TTGOClass*)'
my-ttgo-watch.ino:58: undefined reference to splash_screen_stage_update(char const*, int)' my-ttgo-watch.ino:62: undefined reference to splash_screen_stage_update(char const*, int)'
my-ttgo-watch.ino:65: undefined reference to splash_screen_stage_update(char const*, int)' my-ttgo-watch.ino:66: undefined reference to splash_screen_stage_update(char const*, int)'
my-ttgo-watch.ino:67: undefined reference to splash_screen_stage_update(char const*, int)' my-ttgo-watch.ino:68: undefined reference to powermgm_setup(TTGOClass*)'
my-ttgo-watch.ino:71: undefined reference to splash_screen_stage_update(char const*, int)' my-ttgo-watch.ino:72: undefined reference to gui_setup()'
my-ttgo-watch.ino:72: undefined reference to weather_app_setup()' my-ttgo-watch.ino:74: undefined reference to stopwatch_app_setup()'
my-ttgo-watch.ino:75: undefined reference to example_app_setup()' my-ttgo-watch.ino:75: undefined reference to wifictl_on()'
my-ttgo-watch.ino:77: undefined reference to splash_screen_stage_finish(TTGOClass*)' my-ttgo-watch.ino:78: undefined reference to display_get_brightness()'
my-ttgo-watch.ino:82: undefined reference to display_set_brightness(unsigned int)' my-ttgo-watch.ino:84: undefined reference to blectl_setup()'
my-ttgo-watch.ino.cpp.o: In function loop()': my-ttgo-watch.ino:100: undefined reference to gui_loop(TTGOClass*)'
my-ttgo-watch.ino:100: undefined reference to powermgm_loop(TTGOClass*)' collect2.exe: error: ld returned 1 exit status

can you advice please,
thanks,
Domi.

Time zone has no effect

Hi,

Time zone has no effect for me, I have tried +2, +3, it always stays on the same hour ...

any clue ?
thanks,
Domi.

Bluetooth problem

There is no way to connect my watch to my iPhone SE 1st generation (just for testing connexion) is "normal" ?

Random Crashes

Hi,
Not sure if your aware but i get random crashes

syncToRtc: 120 8 9 - 10 8 15
[E][weather_fetch.cpp:101] weather_fetch_forecast(): HTTPClient error 401
[E][weather_fetch.cpp:56] weather_fetch_today(): HTTPClient error 401
syncToRtc: 120 8 9 - 10 18 26
[E][weather_fetch.cpp:56] weather_fetch_today(): HTTPClient error 401
[E][weather_fetch.cpp:101] weather_fetch_forecast(): HTTPClient error 401
syncToRtc: 120 8 9 - 10 19 42
Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400e4163 PS : 0x00060f30 A0 : 0x800e49f4 A1 : 0x3ffb1b80
A2 : 0x00000000 A3 : 0x00000010 A4 : 0x3f45b71c A5 : 0x3ffb1d60
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x00000000 A9 : 0x00000000
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x00000010 A13 : 0x3f45b71c
A14 : 0x00000005 A15 : 0x00000004 SAR : 0x00000001 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x400ec960 LEND : 0x400ec988 LCOUNT : 0x0000000e

Backtrace: 0x400e4163:0x3ffb1b80 0x400e49f1:0x3ffb1cd0 0x400f3c78:0x3ffb1d30 0x400e2e36:0x3ffb1df0 0x400e2ec7:0x3ffb1e40 0x400e2f1c:0x3ffb1e90 0x400e2f84:0x3ffb1eb0 0x400e344e:0x3ffb1ee0 0x400ecaeb:0x3ffb1f30 0x400ecc05:0x3ffb1f50 0x400d4b4d:0x3ffb1f70 0x400db021:0x3ffb1f90 0x4011386d:0x3ffb1fb0 0x4008d721:0x3ffb1fd0

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
starting t-watch V1, version: 2020080702
Total heap: 242136
Free heap: 160272
Total PSRAM: 4194236
Free PSRAM: 4079036
[E][weather_fetch.cpp:56] weather_fetch_today(): HTTPClient error 401
[E][weather_fetch.cpp:101] weather_fetch_forecast(): HTTPClient error 401
syncToRtc: 120 8 9 - 10 20 13

PR: Upnp presentation / SSDP

Hi, here is some small code for the watch to be visable in the network in Windows.

A double click opens the device webpage.
In the context menu you get additional information
(it not exact matches the title i.e. serial number -> SW version, modelnumber -> hostname).

This allows you to run the watch on DHCP and/or find it easily in you network neighborhood.
!! Clear, the watch must on Wi-Fi !!

@sharandac feel free to change the content.

Pictures
pnp_1

20200807_New Issue · sharandac_My-TTGO-Watch_000162

How to implement
in PlatformIO, install ESP32SSDP library from me-no-dev

webserver.h:
#define UPNPPORT 80

webserver.c:

top:
#include <ESP32SSDP.h> // ESP32 upnp

somewhere:

  //Upnp presentation website
  //#todo - use global information:

#define DEV_NAME "My-Watch" 
#define DEV_INFO "Watch based on ESP32 from Espressif Systems"

  asyncserver.on("/description.xml", HTTP_GET, [](AsyncWebServerRequest *request) {
    byte mac[6];
    WiFi.macAddress(mac);
    char tmp[12 + 1];
    snprintf(tmp, sizeof(tmp), "%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
    String MacStrPart = String(tmp).substring(6);

    String xmltext = String("<?xml version=\"1.0\"?>\n") +
            "<root xmlns=\"urn:schemas-upnp-org:device-1-0\">\n"
            "<specVersion>\n"
            "\t<major>1</major>\n"
            "\t<minor>0</minor>\n"
            "</specVersion>\n"
            "<URLBase>http://" + WiFi.localIP().toString() + "/</URLBase>\n" 
            "<device>\n"
            "\t<deviceType>upnp:rootdevice</deviceType>\n"

            /*this is the icon name in Windows*/
            /*"\t<friendlyName>" + WiFi.getHostname() + "</friendlyName>\n"*/ 
            "\t<friendlyName>" + DEV_NAME + " " + MacStrPart + "</friendlyName>\n" /*because the hostename is 'Espressif' */

            "\t<presentationURL>/</presentationURL>\n"
            "\t<manufacturer>" + "Dirk Broßwick (sharandac)" + "</manufacturer>\n"
            "\t<manufacturerURL>https://github.com/sharandac/My-TTGO-Watch</manufacturerURL>\n"
            "\t<modelName>" +  DEV_INFO + "</modelName>\n"

            "\t<modelNumber>" + WiFi.getHostname() + "</modelNumber>\n"
            "\t<modelURL>" +
            "/" + "</modelURL>\n"

            "\t<serialNumber>Build: " + __FIRMWARE__ + "</serialNumber>\n"
            //The last six bytes of the UUID are the hardware address of the first Ethernet adapter in the system the UUID was generated on.
            "\t<UDN>uuid:38323636-4558-4DDA-9188-CDA0E6" + MacStrPart + "</UDN>\n"
            "</device>\n"
            "</root>\r\n"
            "\r\n";

    request->send(200, "text/xml", xmltext);
  });

before the 'asyncserver.begin();':

  //Upnp / SSDP presentation - Multicast  - link to description.xml
  SSDP.setSchemaURL("description.xml");
  SSDP.setHTTPPort(UPNPPORT);
  SSDP.setURL("/");
  SSDP.setDeviceType("upnp:rootdevice");
  SSDP.begin();

Hope you find it useful !
Joe

Some wishes

Great that someone start writing a SW for this piece of HW. I love the first version, and the WiFi PW Keyboard is unbelievable well working !

Some wishes:

  • set the focus on a stable, working and long working watch function (the time is often lost - RTC used?)
    (if the base unctions are given it make sense to wear it and from time to time check for updates.)
  • if on power, enable WiFi, open Web server, sync time and use a longer display-on time
  • show more information like in battery life info (over all the IP address, gyro and sensors, license and project,... )
  • Web server, have a index.htm, may use bootstrab, do the most settings via web (it's more easy)
  • have a concept to sync with Smartphone (notifications)
  • change positive things to green color (bootscreen, sliders bullets, switch backgrounds)
  • Update - switch WiFi (if on power) automatically on (update not working yet ?)
  • (Arduino IDE would be more common)
  • App to Apps :)

BR Joe

New App Icon does not appear

I am looking to add a new app. Copied the sample app files, renamed all the references and started a draft.
When I upload however the new app does not appear.

Does the new app need to be registered somewhere?

Keyboard is impossible to use

This is more of a usability issue then a "bug" in the code. The keyboard implementation is really impossible to use, even with a stylized pen since the touch sensor isn't accurate enough.
It took me like over 15 minutes to type in the SSID.

Please consider making the keyboard class like this: (see )

const char *Keyboard::btnm_mapplus[10][23] = {
    {
        "a", "b", "c",   "\n",
        "d", "e", "f",   "\n",
        "g", "h", "i",   "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "j", "k", "l", "\n",
        "n", "m", "o",  "\n",
        "p", "q", "r",  "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "s", "t", "u",   "\n",
        "v", "w", "x", "\n",
        "y", "z", " ", "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "A", "B", "C",  "\n",
        "D", "E", "F",   "\n",
        "G", "H", "I",  "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "J", "K", "L", "\n",
        "N", "M", "O",  "\n",
        "P", "Q", "R", "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "S", "T", "U",   "\n",
        "V", "W", "X",   "\n",
        "Y", "Z", " ", "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "0", "1", "2",  "\n",
        "3", "4", "5",  "\n",
        "6", "7", "8",  "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "9", "+", "-",  "\n",
        "/", "*", "=",  "\n",
        "!", "?", "#",  "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "<", ">", "@",  "\n",
        "%", "$", "(",  "\n",
        ")", "{", "}",  "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    },
    {
        "[", "]", ";",  "\n",
        "\"", "'", ".", "\n",
        ",", ":",  " ", "\n",
        LV_SYMBOL_OK, "Del", "Exit", LV_SYMBOL_RIGHT, ""
    }
};

How to use guide?

This compiled and uploaded just fine, but I don't know how to use it. I can swipe down from the top and reveal "Scan.." or "Activate" with a WiFi logo, and that's it.

How do I scroll to the other settings, etc?

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.