probonopd / WirelessPrinting

Print wirelessly from Cura, PrusaSlicer or Slic3r to your 3D printer connected to an ESP8266 or ESP32 module
352 stars 65 forks source link

Added ESP-DASH ( Base Template ) #134

Open ayushsharma82 opened 4 years ago

ayushsharma82 commented 4 years ago

Added ESP-DASH Core functions. Please use this template as a base to add more functions to the dashboard.

ESP-DASH Docs: https://github.com/ayushsharma82/ESP-DASH/wiki/Building-Sketch

probonopd commented 4 years ago

Hi, thanks for adding this. Looking at the code it is not evident to me where the widgets are getting their data from, how does it work?

ayushsharma82 commented 4 years ago

@probonopd ESP-DASH Works on 2 methods: addCard and updateCard. Add Card Method is used to add a card on the dashboard while the update card method is used to update the values of that specific card.

A Unique ID is used for every card while adding a card. ie: https://github.com/probonopd/WirelessPrinting/pull/134/files#diff-ef932246a9d229efe8048ee0dccbddbfR856 Example: ESPDash.addTemperatureCard("bed", unit, value);

That same ID will be used to update the card in the future. Example: ESPDash.updateTemperatureCard("bed", value);

probonopd commented 4 years ago

Thanks @ayushsharma82 can you add an example to your code that uses the data at /api/printer? There we have

{
  "state": {
    "text": "Operational",
    "flags": {
      "operational": true,
      "paused": false,
      "printing": false,
      "pausing": false,
      "cancelling": false,
      "sdReady": false,
      "error": false,
      "ready": true,
      "closedOrError": false
    }
  },
  "temperature": {
    "tool0": {
      "actual": 28.61,
      "target": 0.00,
      "offset": 0
    },
    "bed": {
      "actual": 28.58,
      "target": 0.00,
      "offset": 0
    }
  },
  "sd": {
    "ready": false
  }
}
ayushsharma82 commented 4 years ago

It compiles but crashes in real-life testing on an esp8266.

probonopd commented 4 years ago

Uh, do you have a clue why?

ayushsharma82 commented 4 years ago

No clue yet. I will check for the error later on.