OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › ospi2.img seems outdated
- This topic has 17 replies, 6 voices, and was last updated 9 years, 2 months ago by sakos.
-
AuthorPosts
-
May 30, 2015 at 5:09 pm #38059
karolisParticipantHi,
Just got my first opensprinkler and 3rd raspi from mail!
Don’t know if this has been mentioned before, but the latest raspi hardware doesn’t boot from provided ospi image (/ospi/ospi2.img.zip). I get no output on HDMI and no sign of boot.
Inserted the same card into an older raspberry (1B+), ran “rpi-update” and the image is now bootable on the new model as well.
After the update, the interval program on port 8080 doesn’t run though, didn’t have time to look into that one yet.
K.
May 31, 2015 at 5:09 am #38062
karolisParticipantInstalled as per tutorial here https://opensprinkler.com/forums/topic/tutorial-install-opensprinkler-unified-on-a-fresh-raspbian-image-for-a-pi-2/ and it works.
The OS image and the docs could use an update though, as for the new user it isn’t very clear where to start. Normally the easiest way to go is to download a pre-configured image, which in this case doesn’t contain required kernel and latest software.
June 1, 2015 at 1:10 am #38077
RayKeymasterSorry about the delay. I’ve just updated the OSPi pre-configured SD card image today (it now supports RPi 2 as well), and also updated the user manual. The user manual is in the same location as before:
http://rayshobby.net/docs/ospi14_manual.pdf
and the image link is in the manual.June 11, 2015 at 4:09 am #38318
karolisParticipantthanks.
In the ospi image, in /etc/network/interfaces I would suggest changing the default of “wpa-conf” with “wpa-roam” (since the inet is set to manual anyway).
This handles weaker wifi signals better and reconnects automatically.
K.
June 12, 2015 at 12:18 pm #38364
RayKeymasterOK, thanks for the suggestion. Will take this into account the next time I update the image.
June 22, 2015 at 2:50 am #38598
karolisParticipantAfter playing a few weeks with this, I must say both hardware and firmware of ospi are pretty impressive 🙂 One thing that happened last week, was that OpenSprinkler process terminated for (probably) no reason. Ospi was up for 8 days, and one day the program just didn’t run. Web interface was not available, and on ssh I could see that OpenSprinkler process was not running.
I would like to find the cause of this and help to make ospi more stable. It is probably going to happen to other people as well, since I am using the same hardware and OS image as everyone else does. Where do I begin? Are there any OpenSprinkler process exit codes to look for?
thanks
June 22, 2015 at 4:29 am #38600
WokkeltjeParticipantI had the same issue a few times and created a script to check every 15 minutes if the OS process is running or not and to start if needed.
I will check this evening in the logfile if the process has ben restarted again in the last couple of days.I will post the script here also.
This issue happend with version 2.1.4 and I don’t know (did not check the logfile) if the problem was solved after the 2.1.5 update.
June 22, 2015 at 4:58 am #38601
karolisParticipantChecking every 15 minutes if the app is running honestly sounds a bit like a hack.
If opensprinkler really needs a supervisor / watchdog, then IMO something like an init.d script with a supervisor process would be more appropriate, where you could start/stop the service as needed. If it is not already available, I could work on one.
June 22, 2015 at 6:34 am #38603
WokkeltjeParticipantI created the check (indeed it is a hack) just to know if and when the issue happened and to restart the OS service.
Since nobody reported this issue, I was expecting the issue to be related to my setup. (there is a forum topic about my issue)
As I told, I will have a look in my logfile if this is still an issue in my setup.
June 22, 2015 at 8:01 pm #38626
SamerKeymasterThe issue with the crashing has been resolved in the latest release. One user actually posted details about the crash and the required fix which are now incorporated into the code.
Thanks!
Update: With that said, any improvements to the current init.d script would be welcome.
October 13, 2015 at 1:54 pm #40511
sakosParticipantAfter installing the latest OSPi SD Card Image 2 I found that it handles the Real Time Clock out of the box. I tried to compare the actual configuration with the description of this RTC settings wiki page. There are some differences e.g.
– the ntp settings to use RTC as source of time if no internet connection is available
– cron script to calibrate the RTC from the system clock once a week
– cron script to adjust the RTC for drift each day
Despite of this differences the RTC was synchronized automatically and Pi gets the RTC time if there is no internet access. Can I consider that everything is fully configured in this image and RTC will work as expected including daily and weekly adjustments?October 17, 2015 at 11:34 am #40537
RayKeymasterSince the pre-configured SD card image was made quite a while ago, I don’t quite remember the details and how it differs from the Wiki page. But I am pretty sure it has included configurations for the RTC.
October 17, 2015 at 11:59 am #40538
sakosParticipantI would also highly appreciate a supervisor solution including watchdog. It would be so bad if the system halted when a station is open. e.g during a one week holiday.
October 17, 2015 at 9:11 pm #40546
RayKeymasterDo you mean adding an additional watchdog chip or something else? RPi has a hardware watchdog, and this section of the wiki page explains how to set it up:
http://rayshobby.net/mediawiki/index.php/Set_Up_RPi,_RTC,_WiFi,_Data_Log#Hardware_watchdogOctober 18, 2015 at 3:45 am #40550
sakosParticipantI mean adding the Pi watchdog handling into the firmware. If the firmware got stuck for any reason the watchdog would restart the Pi and hopefully shut down the running stations.
October 26, 2015 at 3:30 pm #40620
sakosParticipantI managed to add watchdog handling in OSPI. It was pretty easy. Are you interested?
November 1, 2015 at 8:37 pm #40643
AnonymousInactiveI am…
November 2, 2015 at 11:59 am #40659
sakosParticipantThese are the changes. I also added the clearing of all stations in case of managed shutdown of OSPI. I think it is necessary to prevent unwanted water leak due to a valve left open accidentally. I would like to mention here that RF stations are not closed by forced clearing of stations.
OpenSprinkler.h
@@ -38,6 +38,8 @@ #include <string.h> #include <unistd.h> #include "etherport.h" + #include "linux/watchdog.h" + #include "sys/ioctl.h" @@ -195,5 +197,6 @@ private: #endif #endif // LCD functions }; + static int deviceHandle = -1; // Watchdog device handler
defines.h
@@ -378,6 +378,7 @@ typedef enum { typedef short int16_t; typedef unsigned short uint16_t; typedef bool boolean; + #define WATCHDOG_TIMEOUT 15
main.cpp
@@ -249,6 +249,17 @@ ISR(WDT_vect) #else void do_setup() { + +#if defined(OSPI) + // Try to inicialize Watchdog device + // deviceHandle >=0 indicates success + if ((deviceHandle = open("/dev/watchdog", O_WRONLY)) < 0) { + DEBUG_PRINTLN("Error: Couldn't open watchdog device!"); + } else { + ioctl(deviceHandle, WDIOC_SETTIMEOUT, WATCHDOG_TIMEOUT); + DEBUG_PRINTLN("Watchdog device opened."); + } +#endif @@ -647,6 +659,11 @@ void do_loop() // check weather check_weather(); + // kick Watchdog + // deviceHandle can have valid value only in case of OSPI + if (deviceHandle >= 0) { + ioctl(deviceHandle, WDIOC_KEEPALIVE, 0); + } }
OpenSprinkler.cpp
@@ -419,13 +419,31 @@ void OpenSprinkler::reboot_dev() { #if defined(DEMO) // do nothing #else + // Reset all stations before quit + clear_all_station_bits(); + apply_all_station_bits(); + sync(); // add sync to prevent file corruption - reboot(RB_AUTOBOOT); + // Stop Watchdog by sending magic character + // deviceHandle can have valid value only in case of OSPI + if (deviceHandle >= 0) { + write(deviceHandle, "V", 1); + }; + reboot(RB_AUTOBOOT); #endif } /** Launch update script */ void OpenSprinkler::update_dev() { + // Reset all stations before quit + clear_all_station_bits(); + apply_all_station_bits(); + + // Stop Watchdog by sending magic character + // deviceHandle can have valid value only in case of OSPI + if (deviceHandle >= 0) { + write(deviceHandle, "V", 1); + }; char cmd[1024]; sprintf(cmd, "cd %s & ./updater.sh", get_runtime_path()); system(cmd);
Apply these changes and build OSPI with
sudo ./build.sh ospi
command.To make watchdog work you have to edit /etc/modules file (sudo nano /etc/modules) and add this line to the end:
bcm2708_wdog
After restart the watchdog is operating. To test it stop the software with
sudo /etc/init.d/OpenSprinkler.sh stop
command. You will observe that the connection to the OSPI system is lost but will be automatically available again within 30-40 seconds.I would appreciate if these changes were added to the official release.
-
AuthorPosts
- You must be logged in to reply to this topic.
OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › ospi2.img seems outdated