-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
When trying using '??' wildcard it produces errors like
-bash: 10#%%/1016+(10#%%%10): syntax error: operand expected (error token is "%/1016+(10#%%%10)")
it also happens when using it indirectly trying to set startup timer with wittyPi.sh using '5. Schedule next startup'
and if wildcard is set correctly menu #5 doesn't recognize that, saying that "Auto startup time is not set yet."
the same issue applies to set_shutdown_time().
below patch fixes set_startup_time()/set_shutdown_time() functions, fixing wittyPi.sh and the rest I'll leave up to you.
(issue is due to using special symbol '?' without paying attention how it's expanded in parameters)
--- wittypi/utilities.sh.orig 2020-07-19 21:32:48.820942463 +0200
+++ wittypi/utilities.sh 2020-07-19 21:34:30.979628928 +0200
@@ -265,25 + @@
set_startup_time()
{
i2c_write 0x01 $I2C_RTC_ADDRESS 0x0E 0x07
- if [ $4 == '??' ]; then
+ if [ "$4" == '??' ]; then
sec='128'
else
sec=$(dec2bcd $4)
fi
i2c_write 0x01 $I2C_RTC_ADDRESS 0x07 $sec
- if [ $3 == '??' ]; then
+ if [ "$3" == '??' ]; then
min='128'
else
min=$(dec2bcd $3)
fi
i2c_write 0x01 $I2C_RTC_ADDRESS 0x08 $min
- if [ $2 == '??' ]; then
+ if [ "$2" == '??' ]; then
hour='128'
else
hour=$(dec2bcd $2)
fi
i2c_write 0x01 $I2C_RTC_ADDRESS 0x09 $hour
- if [ $1 == '??' ]; then
+ if [ "$1" == '??' ]; then
date='128'
else
date=$(dec2bcd $1)
@@ -319,19 +319,19 @@
set_shutdown_time()
{
i2c_write 0x01 $I2C_RTC_ADDRESS 0x0E 0x07
- if [ $3 == '??' ]; then
+ if [ "$3" == '??' ]; then
min='128'
else
min=$(dec2bcd $3)
fi
i2c_write 0x01 $I2C_RTC_ADDRESS 0x0B $min
- if [ $2 == '??' ]; then
+ if [ "$2" == '??' ]; then
hour='128'
else
hour=$(dec2bcd $2)
fi
i2c_write 0x01 $I2C_RTC_ADDRESS 0x0C $hour
- if [ $1 == '??' ]; then
+ if [ "$1" == '??' ]; then
date='128'
else
date=$(dec2bcd $1)
Metadata
Metadata
Assignees
Labels
No labels