alvarowolfx / asset-tracker-gcp-mongoose-os

🚧 An Asset Tracker made with an ESP32 running MongooseOS + GPS and GPRS Module, sending data through Google Cloud IoT Core
https://medium.com/google-cloud/gps-cellular-asset-tracking-using-google-cloud-iot-core-firestore-and-mongooseos-4dd74921f582
71 stars 22 forks source link

MJS error: calling non-callable #7

Open vishnu-chalil opened 5 years ago

vishnu-chalil commented 5 years ago

I updated and build the firmware with new version tools and now I am stuck in this.All I get is this output

    [Aug  3 21:48:10.173] Setting timer with  300  seconds interval 
    [Aug  3 21:48:10.188]   at init.js:181
    [Aug  3 21:48:10.190] MJS error: calling non-callable
    [Aug  3 21:48:10.193] mgos_pppos_uart_disp Connecting (UART2, APN 'airtelgprs.com')...
    [Aug  3 21:48:10.201] mongoose_poll        New heap free LWM: 188456
    [Aug  3 21:48:10.206] mgos_net_on_change_c PPP: disconnected
    [Aug  3 21:48:12.690] mgos_net_on_change_c PPP: connecting
    [Aug  3 21:48:12.825] mgos_net_on_change_c PPP: connected
    [Aug  3 21:48:12.829] mgos_pppos_uart_disp Starting PPP, user ''
    [Aug  3 21:48:12.848] mongoose_poll        New heap free LWM: 186520
    [Aug  3 21:48:18.880] mgos_pppos_status_cb Error 6 (phase 0), reconnect
    [Aug  3 21:48:18.886] mgos_pppos_uart_disp Connecting (UART2, APN 'airtelgprs.com')...
[Aug  3 21:48:18.893] mgos_net_on_change_c PPP: disconnected
[Aug  3 21:48:21.281] mgos_net_on_change_c PPP: connecting
[Aug  3 21:48:21.796] mgos_net_on_change_c PPP: connected
[Aug  3 21:48:21.801] mgos_pppos_uart_disp Starting PPP, user ''
[Aug  3 21:48:21.820] mongoose_poll        New heap free LWM: 185688
[Aug  3 21:48:27.851] mgos_pppos_status_cb Error 6 (phase 0), reconnect
[Aug  3 21:48:27.857] mgos_pppos_uart_disp Connecting (UART2, APN 'airtelgprs.com')...

Is there something that I could have possibly missed

bblanke commented 4 years ago

Howdy! You might need to add the function to your object in Object.create.

Example from my code from another project:

let ThermalPrinter = {
  create: function(uart_no, dtr_pin, heatTime) {
    return Object.create({
      _i: ThermalPrinter._c(uart_no, dtr_pin, heatTime),

      print: ThermalPrinter.print,
      had to add this >> println: ThermalPrinter.println
    });
  },

  print: function(str) {
    ThermalPrinter._print(this._i, str, str.length);
  },

  println: function(str) {
    ThermalPrinter._println(this._i, str, str.length);
  },

  _c: ffi('void *thermal_printer_create(int, int, int)'),
  _print: ffi('void print(void *, char *, int)'),
  _println: ffi('void println(void *, char *, int)'),
}