本文整理汇总了C++中settings::setTimeout方法的典型用法代码示例。如果您正苦于以下问题:C++ settings::setTimeout方法的具体用法?C++ settings::setTimeout怎么用?C++ settings::setTimeout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings
的用法示例。
在下文中一共展示了settings::setTimeout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processDisk
//
// processDisk() - called when a disk is discovered and properly located
// on P2. This routine does everything that the Chapr can
// do with a flash drive, like update the name of the Chapr.
//
void VDIP::processDisk(portConfig *portConfigBuffer)
{
char buf[BIGENOUGH];
// check that it's in port two (beep annoyingly otherwise)
if(portConfigBuffer->port == 1) {
// read through VDIP stuff looking for a text file with the name, personality etc.
// PLEASE NOTE -- FILE NAMES MUST BE FEWER THAN 8 CHARACTERS
// get the new name of the ChapR
if(readFile("name.txt", buf, BIGENOUGH)){
if (buf[EEPROM_NAMELENGTH - 1] == '\0'){
myEEPROM.setName(buf);
}
}
// get the new personality
if(readFile("person.txt", buf, BIGENOUGH)){
byte newNum = (byte) atoi(buf);
if (newNum > 0 && newNum <= EEPROM_LASTPERSON){
myEEPROM.setPersonality(newNum);
}
}
// get the power-down timeout
if(readFile("timeout.txt", buf, BIGENOUGH)){
byte newNum = (byte) atoi(buf);
if (newNum >= 0 && newNum <= EEPROM_MAXTIMEOUT){
myEEPROM.setTimeout(newNum);
}
}
// get the lag time
if(readFile("lag.txt", buf, BIGENOUGH)){
byte newNum = (byte) atoi(buf);
if (newNum >= 0 && newNum <= EEPROM_MAXLAG){
myEEPROM.setSpeed(newNum);
}
}
// get the user mode
if(readFile("mode.txt", buf, BIGENOUGH)){
byte newNum = (byte) atoi(buf);
if (newNum >= 0 && newNum <= EEPROM_MAXMODE){
myEEPROM.setMode(newNum);
}
}
// allows user to determine number of seconds in autonomous, teleOp and endgame (ChapR3 of EEPROM)
// zero for either mode skips the mode
if(readFile("mConfig.txt",buf, BIGENOUGH)){
char *ptr = buf;
for (int i = 0; i < 3; i++){
switch(i){
case 0: myEEPROM.setAutoLen(atoi(ptr));break;
case 1: myEEPROM.setTeleLen(atoi(ptr));break;
case 2: myEEPROM.setEndLen(atoi(ptr));break;
}
while (*ptr != '\r' && *ptr != '\0' && *ptr != '\n'){
ptr++;
}
while (*ptr == '\r' && *ptr == '\n'){
ptr++;
}
if (*ptr == '\0'){
break;
}
}
}
// contains the settings for the digital I/O pins (for FRC, aka ChapR3 of EEPROM)
if (readFile("dgtlIn.txt", buf, BIGENOUGH)){
byte newNum = 0;
for (int i = 0, ptr = 0; i < 8; i++){
byte bit = (buf[ptr] == '1')?1:0;
newNum |= bit<<i;
while (buf[ptr] != '\r' && buf[ptr] != '\0' && buf[ptr] != '\n'){
ptr++;
}
while (buf[ptr] == '\r' || buf[ptr] == '\n'){
ptr++;
}
if (buf[ptr] == '\0'){
//.........这里部分代码省略.........