Seytonic / malduino

All the Malduinos!
MIT License
210 stars 52 forks source link

Android 4 pin passcode script #6

Open Saikomorisan opened 7 years ago

Saikomorisan commented 7 years ago

With this script I had the problem that after failing 5 times the pin had to wait 35 seconds for the DELAY 35000 but after having passed the 35000 milliseconds I did not re-type so I separated the delay into 4 parts 3 of 10000 and 1 of 5000. https://pastebin.com/X7AwBpbB

fionafibration commented 6 years ago

This isn't a very good explanation, I don't know if people will understand what you're saying. I don't.

Nibot1 commented 6 years ago

The max delay in one DELAY command is 32767 because an Integer variable can only hold values from 32767 to -32767 On an Arduino. You need to split your DELAY commands

Nibot1 commented 6 years ago

@Saikomorisan try to add this function below the getInt() method in your .ino file unsigned int getUnsignedInt(char* str, int pos){ if(equals(str, pos+1, pos+7, "RANDOM", 6)){ return random(rMin, rMax); }else{ return String(str).substring(pos+1,pos+6).toInt(); } } and replace thes lines if(equalsBuffer(0,space,"DEFAULTDELAY") || equalsBuffer(0,space,"DEFAULT_DELAY")) defaultDelay = getInt(buf,space); else if(equalsBuffer(0,space,"DEFAULTCHARDELAY") || equalsBuffer(0,space,"DEFAULT_CHAR_DELAY")) defaultCharDelay = getInt(buf,space); else if(equalsBuffer(0,space,"DELAY")) delay(getInt(buf,space)); with tose lines if(equalsBuffer(0,space,"DEFAULTDELAY") || equalsBuffer(0,space,"DEFAULT_DELAY")) defaultDelay = getUnsignedInt(buf,space); else if(equalsBuffer(0,space,"DEFAULTCHARDELAY") || equalsBuffer(0,space,"DEFAULT_CHAR_DELAY")) defaultCharDelay = getUnsignedInt(buf,space); else if(equalsBuffer(0,space,"DELAY")) delay(getUnsignedInt(buf,space));