Commit d944c6c3 刘韬

传感器检测循环后关闭当前传感器

1 个父辈 3d33aaef
{
}
\ No newline at end of file \ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
//3010~3020 //3010~3020
#define LedTypeEPAddress 3010 #define LedTypeEPAddress 3010
#define RowWidthAddress 3020 #define RowWidthAddress 3020
#define MirrorModeAddress 3022
#define FactoryModeAddress 3050 #define FactoryModeAddress 3050
//3100~3200 //3100~3200
#define SensorCheckAddress 3100 #define SensorCheckAddress 3100
......
...@@ -66,20 +66,7 @@ long matrixSelector::getadc(int pin, boolean txEn = true) ...@@ -66,20 +66,7 @@ long matrixSelector::getadc(int pin, boolean txEn = true)
{ {
pinMode(select_pin[i], OUTPUT); pinMode(select_pin[i], OUTPUT);
digitalWrite(select_pin[i], HIGH); // Serial.print("h");Serial.print(select_pin[i]); digitalWrite(select_pin[i], HIGH); // Serial.print("h");Serial.print(select_pin[i]);
#ifdef _25MM
delay(5);
#endif
#ifdef _54MM
delay(10);
#endif
//if (ledcount<40)
//
delayMicroseconds(40*1000/ledcount); delayMicroseconds(40*1000/ledcount);
//if(pin==20 || pin==40)
// delay(5);
//delay(10-ledcount/10);
// if (sendelay>0) delay(sendelay);
} }
else else
{ {
...@@ -96,6 +83,7 @@ long matrixSelector::getadc(int pin, boolean txEn = true) ...@@ -96,6 +83,7 @@ long matrixSelector::getadc(int pin, boolean txEn = true)
// delayMicroseconds(100); // delayMicroseconds(100);
} }
results = results / 10; results = results / 10;
digitalWrite(select_pin[a], LOW);
digitalWrite(35, LOW); digitalWrite(35, LOW);
digitalWrite(34, LOW); digitalWrite(34, LOW);
//if (results == 0 && txEn) //if (results == 0 && txEn)
...@@ -119,8 +107,8 @@ bool matrixSelector::getstatus(int pin) ...@@ -119,8 +107,8 @@ bool matrixSelector::getstatus(int pin)
if (diagnosMode) if (diagnosMode)
Serial << "\r\npin:" << pin << " max:" << max << " min: " << min << " sample : " << sample << " sen% : " << result << ""; Serial << "\r\npin:" << pin << " max:" << max << " min: " << min << " sample : " << sample << " sen% : " << result << "";
if (factoryMode && sample<2) //if (factoryMode && sample<2)
return false; // return false;
if (result > getthreshold(pin)) if (result > getthreshold(pin))
return true; return true;
...@@ -172,9 +160,7 @@ int matrixSelector::getmin(int pin) ...@@ -172,9 +160,7 @@ int matrixSelector::getmin(int pin)
int matrixSelector::getthreshold(int pin) int matrixSelector::getthreshold(int pin)
{ {
int adr = addressInt + (pin * 2) + 600; int adr = addressInt + (pin * 2) + 600;
int threshold = readIntFromEEPROM(adr); int threshold = readIntFromEEPROM(adr);
if (threshold == 0 || threshold > 100) if (threshold == 0 || threshold > 100)
threshold = 20; threshold = 20;
...@@ -190,11 +176,11 @@ void matrixSelector::setcalnum(HardwareSerial *sl, int startpin, int endpin, int ...@@ -190,11 +176,11 @@ void matrixSelector::setcalnum(HardwareSerial *sl, int startpin, int endpin, int
int minadr = addressInt + (pin * 2) + 300; int minadr = addressInt + (pin * 2) + 300;
int thresholdadr = addressInt + (pin * 2) + 600; int thresholdadr = addressInt + (pin * 2) + 600;
// while (!EEPROM.isReady()){} // while (!EEPROM.isReady()){}
sl->println(pin); *sl << pin <<","<<max<<","<<min<<","<<threshold<<"\r\n";
if (max > 0) if (max > 0)
writeIntIntoEEPROM(maxadr, max, true); writeIntIntoEEPROM(maxadr, max, true);
if (min > 0) if (min >= 0)
writeIntIntoEEPROM(minadr, min, true); writeIntIntoEEPROM(minadr, min, true);
if (threshold > 0) if (threshold > 0)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!