OXRS-IO / OXRS-IO-TouchPanel-ESP32-FW

OXRS compatible firmware for WT32-xxx touch screen displays
https://oxrs.io/docs/firmware/touch-panel-esp32.html
BSD 3-Clause "New" or "Revised" License
20 stars 3 forks source link

Rotation for bg image #11

Closed moinmoin-sh closed 2 years ago

moinmoin-sh commented 2 years ago

This allows to rotate the bg image.

EDIT: updated to match latest changes

An additional parameter is added to the payload and the stucture of the payload has changed (sorry):

{
  "tiles":[
    {
      "screen": <number>,
      "tile": <number>,
      "bgImage": 
      {
        "base64": "<encodeBase64(.png)>",
        "zoom": <number>,
        "angle": <number>
        "offset": [<x number>,<y number>],
      }
    }
  ]
}
sumnerboy12 commented 2 years ago

I wonder if we should look to re-organise this payload a bit - the zoom, posOffset and angle are image only related but they are in the root tile payload.

What about something like;

{
  "tiles":[
    {
      "screen": <number>,
      "tile": <number>,
      "image": {
        "base64": "<encodeBase64(.png)>",
        "zoom": <number>,
        "offset": [<x number>,<y number>],
        "angle": <number>
      }
    }
  ]
}
moinmoin-sh commented 2 years ago

That makes sense. I was already thinking about an additional cmnd/ that set the parameters of a previously sent image which saves sending and rendering the same image everytime

{
  "tiles":[
    {
      "screen": <number>,
      "tile": <number>,
      "imageProperties": {
        "zoom": <number>,
        "offset": [<x number>,<y number>],
        "angle": <number>
      }
    }
  ]
}
sumnerboy12 commented 2 years ago

Would it make sense to keep everything in the one "image": {} payload, and if you don't want/need to send the image itself you just leave out the "base64": <> field (i.e. if already sent earlier)?

moinmoin-sh commented 2 years ago

OK, so empty "image" (may be change to "bgImage") payload means remove the image missing/empty "base64" means use existing image

sumnerboy12 commented 2 years ago

That sounds good to me.

moinmoin-sh commented 2 years ago

Please see updated top comment.

sumnerboy12 commented 2 years ago

Looks great, ship it!