Made the serial loop run twice because sometimes it doesn't catch on the first try.
This commit is contained in:
parent
2b4f5dde6e
commit
60c2d681e2
|
@ -29,6 +29,8 @@ puts "Content-type: text/html \r\n\r\n"
|
||||||
|
|
||||||
if users[cgi['user']]['pass'].to_s == (Digest::SHA2.new(bitlen=512) << cgi['pass']).to_s then
|
if users[cgi['user']]['pass'].to_s == (Digest::SHA2.new(bitlen=512) << cgi['pass']).to_s then
|
||||||
|
|
||||||
|
2.times do #do the serial stuff twice as sometimes the serial port is occupied
|
||||||
|
|
||||||
serial = SerialPort.new("/dev/ttyUSB0", 57600, 8, 1, SerialPort::NONE)
|
serial = SerialPort.new("/dev/ttyUSB0", 57600, 8, 1, SerialPort::NONE)
|
||||||
serial.print "e 1234\r"
|
serial.print "e 1234\r"
|
||||||
|
|
||||||
|
@ -66,6 +68,8 @@ if users[cgi['user']]['pass'].to_s == (Digest::SHA2.new(bitlen=512) << cgi['pass
|
||||||
serial.close
|
serial.close
|
||||||
puts ' <a href="/~access">Return.</a>'
|
puts ' <a href="/~access">Return.</a>'
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
puts "Invalid username or password."
|
puts "Invalid username or password."
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user