diff --git a/README.md b/README.md index e15985f3..aea63b44 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,15 @@ To force Recovery Mode to be entered on boot and to show the NOOBS interface, yo To force Recovery Mode being entered on boot, connect GPIO pin 3 on header P1 to GND (pin 25). If GPIO pin 3 remains unconnected then it will boot through to the installed OS as normal. +##### Modifying the GPIO Trigger +If you would like to use a different GPIO pin, for example if you have a push button or similar mechanism, to trigger the Recovery Mode append the `gpiotriggerenable` as described above and then perform the following steps: +1. Append `gpiochannel=[gpiopin]` to the argument list in the `recovery.cmdline` file which is found in the root NOOBS directory. `[gpiopin]` should be the GPIO pin number you wish to use, for example to use GPIO 15 you would append: `gpiochannel=15` +2. Reboot + +If you would like the GPIO pin to only trigger the Recovery Mode when the GPIO value becomes high instead of low (default) perform the following steps: +1. Append `gpiochannelvalue=[value]` to the argument list in the `recovery.cmdline` file which is found in the root NOOBS directory. `[value]` should be `1` if you want the trigger when the GPIO pin is high and `0` when the pin is low (default). For example to continue our example from above using GPIO 15, if we want to have it trigger when the pin is high you would append: `gpiochannelvalue=1` in addition to the `gpiochannel` argument already added. +2. Reboot + #### How to force Recovery Mode being entered on boot (overrides GPIO or keyboard input) Alternatively, if you are unable to use either the GPIO or keyboard to trigger entering Recovery Mode, you can: diff --git a/buildroot/package/recovery/init b/buildroot/package/recovery/init index 3c4cba0a..002a8e93 100755 --- a/buildroot/package/recovery/init +++ b/buildroot/package/recovery/init @@ -62,6 +62,8 @@ else DEFAULT_KBD= DEFAULT_DISPLAY= DEFAULT_PARTITION= + GPIO_CHANNEL= + GPIO_CHANNEL_VALUE= if grep -q runinstaller /proc/cmdline; then RUN_INSTALLER=-runinstaller @@ -88,9 +90,15 @@ else if [ "${p%%=*}" == "partition" ] ; then DEFAULT_PARTITION="-partition ${p#*=}" fi + if [ "${p%%=*}" == "gpiochannel" ] ; then + GPIO_CHANNEL="-gpiochannel ${p#*=}" + fi + if [ "${p%%=*}" == "gpiochannelvalue" ] ; then + GPIO_CHANNEL_VALUE="-gpiochannelvalue ${p#*=}" + fi done - /usr/bin/recovery $RUN_INSTALLER $GPIO_TRIGGER $KEYBOARD_NO_TRIGGER $FORCE_TRIGGER $DEFAULT_KBD $DEFAULT_LANG $DEFAULT_DISPLAY $DEFAULT_PARTITION -qws 2>/tmp/debug + /usr/bin/recovery $RUN_INSTALLER $GPIO_TRIGGER $KEYBOARD_NO_TRIGGER $FORCE_TRIGGER $DEFAULT_KBD $DEFAULT_LANG $DEFAULT_DISPLAY $DEFAULT_PARTITION $GPIO_CHANNEL $GPIO_CHANNEL_VALUE -qws 2>/tmp/debug fi diff --git a/recovery/config.h b/recovery/config.h index ad6a64e5..1948b971 100644 --- a/recovery/config.h +++ b/recovery/config.h @@ -2,14 +2,14 @@ #define CONFIG_H /* Version number displayed in the title bar */ -#define VERSION_NUMBER "3.0" +#define VERSION_NUMBER "4.0" /* Color of the background */ // #define BACKGROUND_COLOR Qt::white -#define BACKGROUND_COLOR QColor(0xde, 0xde, 0xde) +#define BACKGROUND_COLOR QColor(0xff, 0x9e, 0x17) /* Highlight color of installed OS */ -#define INSTALLED_OS_BACKGROUND_COLOR QColor(0xef,0xff,0xef) +#define INSTALLED_OS_BACKGROUND_COLOR QColor(0xff,0x9e,0x17) /* Places background.png resource file in center of screen */ #define CENTER_BACKGROUND_IMAGE @@ -18,11 +18,11 @@ #define ENABLE_LANGUAGE_CHOOSER /* Website launched when launching Arora */ -#define HOMEPAGE "http://www.raspberrypi.org/help/" +#define HOMEPAGE "https://www.hrsid.com" /* Location to download the list of available distributions from * Multiple lists can be specified by space separating the URLs */ -#define DEFAULT_REPO_SERVER "http://downloads.raspberrypi.org/os_list_v3.json" +#define DEFAULT_REPO_SERVER "https://repository.hrs.cloud/os_list_v3.json" /* Size of recovery FAT partition in MB when using reformat drive initialization method. */ #define RESCUE_PARTITION_SIZE 63 @@ -43,7 +43,7 @@ #define SETTINGS_PARTITION_SIZE (32 * 2048 - PARTITION_GAP) /* If the image name matches this exactly, mark it as recommended */ -#define RECOMMENDED_IMAGE "Raspbian Full" +#define RECOMMENDED_IMAGE "HRS MSite" /* RiscOS magic */ #define RISCOS_OFFSET_KEY "riscos_offset" diff --git a/recovery/icons/icon.png b/recovery/icons/icon.png new file mode 100644 index 00000000..69b32ced Binary files /dev/null and b/recovery/icons/icon.png differ diff --git a/recovery/icons/raspberry_icon.png b/recovery/icons/raspberry_icon.png deleted file mode 100644 index 9ce2e2ca..00000000 Binary files a/recovery/icons/raspberry_icon.png and /dev/null differ diff --git a/recovery/main.cpp b/recovery/main.cpp index b42e1803..d605153b 100644 --- a/recovery/main.cpp +++ b/recovery/main.cpp @@ -125,6 +125,7 @@ int main(int argc, char *argv[]) qDebug() << "Board revision is " << rev; int gpioChannel; + int gpioChannelValue = 0; if (rev == 2 || rev == 3) gpioChannel = 0; @@ -134,7 +135,6 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); RightButtonFilter rbf; LongPressHandler lph; - GpioInput gpio(gpioChannel); bool runinstaller = false; bool gpio_trigger = false; @@ -185,8 +185,22 @@ int main(int argc, char *argv[]) if (argc > i+1) defaultPartition = argv[i+1]; } + // Allow gpio channel to be specified in commandline + else if (strcmp(argv[i], "-gpiochannel") == 0) + { + if (argc > i+1) + gpioChannel = atoi(argv[i+1]); + } + // Allow gpio channel value i.e pull up or pull down to be specified in commandline + else if (strcmp(argv[i], "-gpiochannelvalue") == 0) + { + if (argc > i+1) + gpioChannelValue = atoi(argv[i+1]); + } } + GpioInput gpio(gpioChannel); + // Intercept right mouse clicks sent to the title bar a.installEventFilter(&rbf); @@ -202,8 +216,8 @@ int main(int argc, char *argv[]) settingsdir.mkdir("/settings"); // Set wallpaper and icon, if we have resource files for that - if (QFile::exists(":/icons/raspberry_icon.png")) - a.setWindowIcon(QIcon(":/icons/raspberry_icon.png")); + if (QFile::exists(":/icons/icon.png")) + a.setWindowIcon(QIcon(":/icons/icon.png")); #ifdef Q_WS_QWS QWSServer::setBackground(BACKGROUND_COLOR); @@ -252,7 +266,7 @@ int main(int argc, char *argv[]) // or no OS is installed (/settings/installed_os.json does not exist) bool bailout = !runinstaller && !force_trigger - && !(gpio_trigger && (gpio.value() == 0 )) + && !(gpio_trigger && (gpio.value() == gpioChannelValue)) && hasInstalledOS(drive); if (bailout && keyboard_trigger) diff --git a/recovery/wallpaper.png b/recovery/wallpaper.png index edf54c96..9561e810 100644 Binary files a/recovery/wallpaper.png and b/recovery/wallpaper.png differ diff --git a/sdcontent/defaults/slides/A.png b/sdcontent/defaults/slides/A.png index 91d0cd06..16e8518d 100644 Binary files a/sdcontent/defaults/slides/A.png and b/sdcontent/defaults/slides/A.png differ