From 3699722e311a81a28dab5601bde8096f15d59fe4 Mon Sep 17 00:00:00 2001 From: Joshua Rocky Tuahta Purba Date: Mon, 7 Feb 2022 03:47:49 +0700 Subject: [PATCH] Update link and pictures --- README.md | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6a5be5e..dfc6ff9 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -# [Digital Clock](https://zzncx.top/posts/digital-clock-part-5/) +# [Digital Clock](https://zzncx.top/posts/digital-clock-part-6/) Arduino based digital clock. -[![Breadboarded project](https://zzncx.top/posts/digital-clock-part-5/tidy-regless-promini-sideway-thumb.jpg)](https://zzncx.top/posts/digital-clock-part-5/tidy-regless-promini-sideway.jpg) -[![Breadboard diagram](https://zzncx.top/posts/digital-clock-part-5/digital-clock-part-5_bb-thumb.png)](https://zzncx.top/posts/digital-clock-part-5/digital-clock-part-5_bb.png) -[![Electronics schematic](https://zzncx.top/posts/digital-clock-part-5/digital-clock-part-5_schem-thumb.png)](https://zzncx.top/posts/digital-clock-part-5/digital-clock-part-5_schem.png) +[![Breadboarded project](https://zzncx.top/posts/digital-clock-part-6/running-without-wallwart-thumb.jpg)](https://zzncx.top/posts/digital-clock-part-6/running-without-wallwart.jpg) +[![Breadboard diagram](https://zzncx.top/posts/digital-clock-part-6/digital-clock-part-6_bb-thumb.png)](https://zzncx.top/posts/digital-clock-part-6/digital-clock-part-6_bb.png) +[![Electronics schematic](https://zzncx.top/posts/digital-clock-part-6/digital-clock-part-6_schem-thumb.png)](https://zzncx.top/posts/digital-clock-part-6/digital-clock-part-6_schem.png) ## Compiling -To be able to compile this, you need to modify the [LcdMenu](https://github.com/forntoh/LcdMenu/tree/2.1.0) library. Edit the [LcdMenu.h](https://github.com/forntoh/LcdMenu/blob/2.1.0/src/LcdMenu.h#L767-L775) from the LcdMenu library, find this: +To be able to compile this, you need to modify the [LcdMenu](https://github.com/forntoh/LcdMenu/tree/2.1.0) library. Edit the [LcdMenu.h](https://github.com/forntoh/LcdMenu/blob/2.1.0/src/LcdMenu.h#L767-L775) file from the LcdMenu library, find this: ```cpp /** * Toggle backlight @@ -34,3 +34,34 @@ Replace it to this: #endif } ``` + +Other than that, if you get warnings like this: +```plaintext +src/main.cpp:71:53: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] + ItemToggle("Alarm", "Yes", "No", cbMenuToggleAlarm), + ^ +src/main.cpp:71:53: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] +``` + +You can make the warning go away by modifying the the [LcdMenu](https://github.com/forntoh/LcdMenu/tree/2.1.0) library. Edit the [MenuItem.h](https://github.com/forntoh/LcdMenu/blob/2.1.0/src/MenuItem.h#L306-L313) file from the LcdMenu library,find this: +```cpp + /** + * @param key key of the item + * @param textOn display text when ON + * @param textOff display text when OFF + * @param callback reference to callback function + */ + ItemToggle(const char* key, char* textOn, char* textOff, fptrInt callback) + : MenuItem(key, textOn, textOff, callback, MENU_ITEM_TOGGLE) {} +``` +Replace it to this: +```cpp + /** + * @param key key of the item + * @param textOn display text when ON + * @param textOff display text when OFF + * @param callback reference to callback function + */ + ItemToggle(const char* key, const char* textOn, const char* textOff, fptrInt callback) + : MenuItem(key, textOn, textOff, callback, MENU_ITEM_TOGGLE) {} +```