You are reading a single comment by @thejoker187 and its replies. Click here to read the full conversation.
  • Hi all,
    I'm working on the Uwatch 2 from umidigi and thanks to @fanoush and @Gordon I was able to have espruino running on it, version is 2v05.29 and I started from this github repo https://github.com/kabbi/espruino-uwatch­ . I'm facing some issues regarding the battery operations. The first one is the about the isCharging() basically it does not detect the pin change from low to high when I plug the charging plug, thanks to @fanoush suggestion I added some printf to understand what happen when isCharging() is called from javascript as you can see below:

    bool jswrap_uwatch_isCharging() {
    [#ifdef](http://forum.espruino.com/searc­h/?q=%23ifdef) BAT_PIN_CHARGING
      jsiConsolePrintf("*-> isCharging Debug: \n");
      jsiConsolePrintf("*-> PIN: %d\n",BAT_PIN_CHARGING);
      jsiConsolePrintf("*-> ReadPin %d\n",jshPinGetValue(BAT_PIN_CHARGING));­
      return jshPinGetValue(BAT_PIN_CHARGING);
    [#else](http://forum.espruino.com/search­/?q=%23else)
    	
      return 0;
    [#endif](http://forum.espruino.com/searc­h/?q=%23endif)
    }
    
    

    and this is the output in the espruino ide when I now call Uwatch.isCharging()

    >Uwatch.isCharging()
    *-> isCharging Debug:
    *-> PIN: 19
    *-> ReadPin 0
    =false
    

    The pin is defined correctly as BAT_PIN_CHARGING but it is not reading the change. Strange thing is that if I use instead digitalRead(19) I can see the pin change when I plug / unplug the charger cable. I would like to fix this if is possible in some way.

    The second issue is about the getBattery() function, it included in the UWATCH.py and is present in the jswrap_uwatch.c but is not available in the interpreter itself if I try to call it in the IDE by doing E.

    I hope the informations are detailed enought

    Any help will be very appreciated

About

Avatar for thejoker187 @thejoker187 started