OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) ospi2.img seems outdated

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #38059

    karolis
    Participant

    Hi,

    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.

    #38062

    karolis
    Participant

    Installed 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.

    #38077

    Ray
    Keymaster

    Sorry 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.

    #38318

    karolis
    Participant

    thanks.

    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.

    #38364

    Ray
    Keymaster

    OK, thanks for the suggestion. Will take this into account the next time I update the image.

    #38598

    karolis
    Participant

    After 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

    #38600

    Wokkeltje
    Participant

    I 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.

    #38601

    karolis
    Participant

    Checking 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.

    #38603

    Wokkeltje
    Participant

    I 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.

    #38626

    Samer
    Keymaster

    The 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.

    #40511

    sakos
    Participant

    After 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?

    #40537

    Ray
    Keymaster

    Since 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.

    #40538

    sakos
    Participant

    I 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.

    #40546

    Ray
    Keymaster

    Do 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_watchdog

    #40550

    sakos
    Participant

    I 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.

    #40620

    sakos
    Participant

    I managed to add watchdog handling in OSPI. It was pretty easy. Are you interested?

    #40643

    Anonymous
    Inactive

    I am…

    #40659

    sakos
    Participant

    These 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.

Viewing 18 posts - 1 through 18 (of 18 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) ospi2.img seems outdated