Skip to content

CloudSchedule #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Dec 6, 2021
Merged

CloudSchedule #284

merged 27 commits into from
Dec 6, 2021

Conversation

pennam
Copy link
Collaborator

@pennam pennam commented Oct 27, 2021

Opening to start integration testing with cloud side.

/cc @eclipse1985

TODO:

@pennam pennam marked this pull request as draft October 27, 2021 09:02
@pennam pennam force-pushed the cloudschedule branch 2 times, most recently from 4b24351 to fe1a8bf Compare November 4, 2021 13:35
@pennam pennam changed the title [WIP] Cloudschedule CloudSchedule Nov 4, 2021
Copy link
Contributor

@aentinger aentinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pennam 👋 ☕ Can I ask you to add a example sketch show-casing how to actually use that property? From looking at the source code I don't really get it 😕

@arduino-libraries arduino-libraries deleted a comment from github-actions bot Nov 8, 2021
@arduino-libraries arduino-libraries deleted a comment from github-actions bot Nov 8, 2021
@arduino-libraries arduino-libraries deleted a comment from github-actions bot Nov 8, 2021
@arduino-libraries arduino-libraries deleted a comment from github-actions bot Nov 8, 2021
@pennam
Copy link
Collaborator Author

pennam commented Nov 8, 2021

@aentinger sure!

@pennam
Copy link
Collaborator Author

pennam commented Nov 9, 2021

Hi @aentinger, i've added a simple sketch just to show how the cloud schedule property can be used.
I must admit that configuring a schedule from a sketch is really ugly, but the configuration part should be handled through the Arduino Create scheduler widget.

To define a schedule 4 field needs to be provided:
frm: uint32_t unix timestamo of schedule starting date and time
to : uint32_t unix timestamp of schedule end date and time. 0 if schedule has no end.
len: uint32_t duration of scheduled event
msk: uint32_t bitfield schedule configuration value.

| 2bits scheduleUnit | 4bits scheduleType | 26 bits schedule Mask |

enum class ScheduleUnit : int {
  Seconds      = 0,
  Minutes      = 1,
  Hours        = 2,
  Days         = 3
};

enum class ScheduleType : int {
  OneShot      = 0,
  FixedDelta   = 1,
  Weekly       = 2,
  Monthly      = 3,
  Yearly       = 4
};

Fixed schedule mask
delta value between events in ScheduleUnit

Weekly schedule mask
0000001 → Sunday
0000010 → Monday
0000100 → Tuesday
0001000 → Wednesday
0010000 → Thursday
0100000 → Friday
1000000 → Saturday

Monthly schedule mask
Day of the month 1 -31

Yearly schedule mask
| Months since January | Day of the month |
|         0-11         |       1-31       |
|         8 bit        |      8 bit       |

@pennam
Copy link
Collaborator Author

pennam commented Nov 9, 2021

Regarding the msk value i think i can easily add some function to ease creation of scheduler configs. Not sure what to do with frm and to fields... 🤔

@arduino-libraries arduino-libraries deleted a comment from github-actions bot Nov 16, 2021
@arduino-libraries arduino-libraries deleted a comment from github-actions bot Nov 16, 2021
@arduino-libraries arduino-libraries deleted a comment from github-actions bot Nov 17, 2021
@pennam pennam marked this pull request as ready for review November 17, 2021 09:50
@pennam
Copy link
Collaborator Author

pennam commented Nov 17, 2021

Hi @aentinger, I still need to fix UnitTests after the last changes, in the meanwhile do you mind having a look to the new example and functions to ease Schedule configuration ?

32292b5 also add support for timezone changes from the cloud.

Thanks

@pennam pennam requested a review from aentinger November 17, 2021 09:56
@pennam pennam force-pushed the cloudschedule branch 2 times, most recently from 08cc475 to c9e4315 Compare November 17, 2021 11:56
@pennam
Copy link
Collaborator Author

pennam commented Nov 17, 2021

rebased on master and squashed some commits to cleanup history

@codecov-commenter
Copy link

codecov-commenter commented Nov 24, 2021

Codecov Report

Merging #284 (bdef41d) into master (c7ed9d7) will increase coverage by 0.08%.
The diff coverage is 96.03%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
+ Coverage   95.31%   95.40%   +0.08%     
==========================================
  Files          25       26       +1     
  Lines         896     1022     +126     
==========================================
+ Hits          854      975     +121     
- Misses         42       47       +5     
Impacted Files Coverage Δ
src/property/Property.cpp 87.91% <ø> (ø)
src/property/types/CloudSchedule.h 96.03% <96.03%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7ed9d7...bdef41d. Read the comment docs.

@pennam
Copy link
Collaborator Author

pennam commented Dec 6, 2021

rebased and squashed some commits to cleanup history before merging.

@github-actions
Copy link

github-actions bot commented Dec 6, 2021

Memory usage change @ fda11b5

Board flash % RAM for global variables %
arduino:mbed:envie_m4 🔺 +152 - +1792 +0.01 - +0.17 🔺 +24 - +24 +0.01 - +0.01
arduino:mbed:envie_m7 🔺 +152 - +1176 +0.02 - +0.15 🔺 +24 - +24 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect 🔺 0 - +128 0.0 - 0.0 🔺 0 - +28 0.0 - +0.01
arduino:samd:mkr1000 🔺 +88 - +1864 +0.03 - +0.71 🔺 +24 - +24 +0.07 - +0.07
arduino:samd:mkrgsm1400 🔺 +112 - +1136 +0.04 - +0.43 🔺 +24 - +24 +0.07 - +0.07
arduino:samd:mkrnb1500 🔺 +88 - +1872 +0.03 - +0.71 🔺 +24 - +24 +0.07 - +0.07
arduino:samd:mkrwan1300 🔺 +64 - +72 +0.02 - +0.03 🔺 +24 - +24 +0.07 - +0.07
arduino:samd:mkrwifi1010 🔺 0 - +1144 0.0 - +0.44 🔺 0 - +24 0.0 - +0.07
arduino:samd:nano_33_iot 🔺 0 - +1144 0.0 - +0.44 🔺 0 - +24 0.0 - +0.07
esp32:esp32:esp32 🔺 +2512 - +3556 +0.19 - +0.27 🔺 +56 - +64 +0.02 - +0.02
esp8266:esp8266:huzzah 🔺 +1564 - +2412 +0.15 - +0.23 🔺 +352 - +372 +0.43 - +0.45
Click for full report table
Board examples/ArduinoIoTCloud-Advanced
flash
% examples/ArduinoIoTCloud-Advanced
RAM for global variables
% examples/ArduinoIoTCloud-Basic
flash
% examples/ArduinoIoTCloud-Basic
RAM for global variables
% examples/utility/ArduinoIoTCloud_Travis_CI
flash
% examples/utility/ArduinoIoTCloud_Travis_CI
RAM for global variables
% examples/utility/Provisioning
flash
% examples/utility/Provisioning
RAM for global variables
% examples/utility/SelfProvisioning
flash
% examples/utility/SelfProvisioning
RAM for global variables
%
arduino:mbed:envie_m4 1792 0.17 24 0.01 1176 0.11 24 0.01 1176 0.11 24 0.01 152 0.01 24 0.01
arduino:mbed:envie_m7 1176 0.15 24 0.0 1176 0.15 24 0.0 1176 0.15 24 0.0 152 0.02 24 0.0
arduino:mbed_nano:nanorp2040connect 128 0.0 28 0.01 128 0.0 28 0.01 128 0.0 28 0.01 0 0.0 28 0.01 0 0.0 0 0.0
arduino:samd:mkr1000 1864 0.71 24 0.07 1160 0.44 24 0.07 1136 0.43 24 0.07 88 0.03 24 0.07
arduino:samd:mkrgsm1400 1128 0.43 24 0.07 1136 0.43 24 0.07 1128 0.43 24 0.07 112 0.04 24 0.07
arduino:samd:mkrnb1500 1872 0.71 24 0.07 1160 0.44 24 0.07 1136 0.43 24 0.07 88 0.03 24 0.07
arduino:samd:mkrwan1300 72 0.03 24 0.07 72 0.03 24 0.07 64 0.02 24 0.07
arduino:samd:mkrwifi1010 1136 0.43 24 0.07 1144 0.44 24 0.07 1144 0.44 24 0.07 128 0.05 24 0.07 0 0.0 0 0.0
arduino:samd:nano_33_iot 1136 0.43 24 0.07 1144 0.44 24 0.07 1144 0.44 24 0.07 120 0.05 24 0.07 0 0.0 0 0.0
esp32:esp32:esp32 3556 0.27 64 0.02 2528 0.19 56 0.02 2512 0.19 56 0.02
esp8266:esp8266:huzzah 2412 0.23 372 0.45 1608 0.15 352 0.43 1564 0.15 356 0.43
Click for full report CSV
Board,examples/ArduinoIoTCloud-Advanced<br>flash,%,examples/ArduinoIoTCloud-Advanced<br>RAM for global variables,%,examples/ArduinoIoTCloud-Basic<br>flash,%,examples/ArduinoIoTCloud-Basic<br>RAM for global variables,%,examples/utility/ArduinoIoTCloud_Travis_CI<br>flash,%,examples/utility/ArduinoIoTCloud_Travis_CI<br>RAM for global variables,%,examples/utility/Provisioning<br>flash,%,examples/utility/Provisioning<br>RAM for global variables,%,examples/utility/SelfProvisioning<br>flash,%,examples/utility/SelfProvisioning<br>RAM for global variables,%
arduino:mbed:envie_m4,1792,0.17,24,0.01,1176,0.11,24,0.01,1176,0.11,24,0.01,152,0.01,24,0.01
arduino:mbed:envie_m7,1176,0.15,24,0.0,1176,0.15,24,0.0,1176,0.15,24,0.0,152,0.02,24,0.0
arduino:mbed_nano:nanorp2040connect,128,0.0,28,0.01,128,0.0,28,0.01,128,0.0,28,0.01,0,0.0,28,0.01,0,0.0,0,0.0
arduino:samd:mkr1000,1864,0.71,24,0.07,1160,0.44,24,0.07,1136,0.43,24,0.07,88,0.03,24,0.07,,,,
arduino:samd:mkrgsm1400,1128,0.43,24,0.07,1136,0.43,24,0.07,1128,0.43,24,0.07,112,0.04,24,0.07,,,,
arduino:samd:mkrnb1500,1872,0.71,24,0.07,1160,0.44,24,0.07,1136,0.43,24,0.07,88,0.03,24,0.07,,,,
arduino:samd:mkrwan1300,72,0.03,24,0.07,72,0.03,24,0.07,64,0.02,24,0.07,,,,,,,,
arduino:samd:mkrwifi1010,1136,0.43,24,0.07,1144,0.44,24,0.07,1144,0.44,24,0.07,128,0.05,24,0.07,0,0.0,0,0.0
arduino:samd:nano_33_iot,1136,0.43,24,0.07,1144,0.44,24,0.07,1144,0.44,24,0.07,120,0.05,24,0.07,0,0.0,0,0.0
esp32:esp32:esp32,3556,0.27,64,0.02,2528,0.19,56,0.02,2512,0.19,56,0.02,,,,,,,,
esp8266:esp8266:huzzah,2412,0.23,372,0.45,1608,0.15,352,0.43,1564,0.15,356,0.43,,,,,,,,

@pennam pennam merged commit 06a2c6c into arduino-libraries:master Dec 6, 2021
@per1234 per1234 added topic: code Related to content of the project itself type: enhancement Proposed improvement labels Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants