[P043] [JSON] Add feature to output times in JSON#5524
[P043] [JSON] Add feature to output times in JSON#5524chromoxdor wants to merge 4 commits intoletscontrolit:megafrom
Conversation
|
Apart from my comments, how do you like the new JSON/Webform writer classes? :) |
The fact that I was able to write working code with it in minutes speaks for itself :) |
The nice thing is, the same code can also be used to add stuff to a webpage, just hand over a different writer type. |
That was not so intuitive for me anymore. 😳 What do you think about the defines? We have a plugin-specific one ( |
|
Never thought that trying to wrap my head around these definitions is such a challenge for me. In the and at the very end I added: |
Well, you're effectively doing the same check twice, that last part I'd simplify to: and also add this similar check: Oh, and this won't work:
Should be like: |
|
yep, shorthand notation like |
|
Last try. I don't know why this is so hard for me.
and at the very end: |
Well, there's 1 small issue here 🤣 The rest looks OK. |
Puhhh… I am relieved. |
|
It is being done when the time is set and on a new date. |
| # if FEATURE_ADDITIONAL_JSON_FROM_PLUGIN | ||
|
|
||
| EventStruct TempEvent(TaskIndex); | ||
| TempEvent.Par1 = reinterpret_cast<intptr_t>(taskWriter.get()); |
There was a problem hiding this comment.
Please don't do nasty things like this. There is a proper pointer in the EventStruct for this.
KeyValueWriter* kvWriter = nullptr;| case PLUGIN_TASK_JSON: | ||
| { | ||
| addLog(LOG_LEVEL_INFO, F("P043 JSON CALLED")); | ||
| auto taskWriter = reinterpret_cast<KeyValueWriter *>(event->Par1); |
There was a problem hiding this comment.
Ditto, please use the already present KeyValueWriter* kvWriter in the EventStruct
| auto timesWriter = taskWriter->createChildArray(F("Times")); | ||
| if (!timesWriter) break; | ||
|
|
||
| LoadTaskSettings(event->TaskIndex); |
There was a problem hiding this comment.
Not 100% sure this is needed as the Cache also does quite a lot of checking.
This is potentially quite a resource intensive operation and should only be done when absolutely needed.
|
@TD-er : If you soon plan to make a new release and find this PR worth merging could you take over for the necessary changes? I am at the hospital right know waiting for a new life to be born and most definitely will not be available for some time. |
Sure, will do. |
No description provided.