Opravy vetsinou nefunkcni inicializace modemu (odstranenim mych pokusu o detekci RING - udelam jinak)
This commit is contained in:
		
							
								
								
									
										25
									
								
								src/DTE.h
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								src/DTE.h
									
									
									
									
									
								
							@@ -15,14 +15,12 @@ class DTE {
 | 
			
		||||
        EXPECT_BUSY,
 | 
			
		||||
        EXPECT_TIMEOUT,
 | 
			
		||||
        EXPECT_DELAY,
 | 
			
		||||
        EXPECT_RESULT,
 | 
			
		||||
        EXPECT_RING
 | 
			
		||||
        EXPECT_RESULT
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
  private:
 | 
			
		||||
    String buffer;
 | 
			
		||||
    Stream & stream;
 | 
			
		||||
    unsigned int bufferIndex;
 | 
			
		||||
    unsigned int bufferSize;
 | 
			
		||||
    String response[3];
 | 
			
		||||
    unsigned long timeout;
 | 
			
		||||
@@ -39,7 +37,7 @@ class DTE {
 | 
			
		||||
 | 
			
		||||
    ~DTE() = default;
 | 
			
		||||
 | 
			
		||||
    void SendCommand(const char * command, unsigned long timeout, const char * response1, const char * response2 = 0, const char * response3 = 0)
 | 
			
		||||
    void SendCommand(const char * command, unsigned long timeout, const char * response1, const char * response2 = nullptr, const char * response3 = nullptr)
 | 
			
		||||
    {
 | 
			
		||||
        match = 0;
 | 
			
		||||
        result = EXPECT_BUSY;
 | 
			
		||||
@@ -54,7 +52,7 @@ class DTE {
 | 
			
		||||
        proccess();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void SendCommand(const __FlashStringHelper * command, unsigned long timeout, const char * response1, const char * response2 = 0, const char * response3 = 0)
 | 
			
		||||
    void SendCommand(const __FlashStringHelper * command, unsigned long timeout, const char * response1, const char * response2 = nullptr, const char * response3 = nullptr)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        match = 0;
 | 
			
		||||
@@ -119,21 +117,8 @@ class DTE {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (result != EXPECT_BUSY) {
 | 
			
		||||
            if (stream.available()) {
 | 
			
		||||
                char c;
 | 
			
		||||
 | 
			
		||||
                c = stream.read();
 | 
			
		||||
                buffer += c;
 | 
			
		||||
                if (buffer.length() > 4) {
 | 
			
		||||
                    if (buffer.endsWith(F("RING\n"))) {
 | 
			
		||||
                        result = EXPECT_RING;
 | 
			
		||||
                    }
 | 
			
		||||
                    buffer.remove(0);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        if (result != EXPECT_BUSY)
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        char c;
 | 
			
		||||
        unsigned long now = millis();
 | 
			
		||||
@@ -141,7 +126,7 @@ class DTE {
 | 
			
		||||
        while (millis() - tick < timeout) {
 | 
			
		||||
            while (stream.available() && (buffer.length() < bufferSize)) {
 | 
			
		||||
                c = stream.read();
 | 
			
		||||
                buffer += c;
 | 
			
		||||
                buffer.concat(c);
 | 
			
		||||
                if (buffer.endsWith(response[0])) {
 | 
			
		||||
                    match = 0;
 | 
			
		||||
                    result = EXPECT_RESULT;
 | 
			
		||||
 
 | 
			
		||||
@@ -676,10 +676,6 @@ class ThreadedGSM {
 | 
			
		||||
        int lastState = ringState;
 | 
			
		||||
        switch (ringState) {
 | 
			
		||||
            case RING_WAIT:
 | 
			
		||||
                if (dte.getResult() == DTE::EXPECT_RING) {
 | 
			
		||||
 | 
			
		||||
                    ringState = RING_CHK;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
 | 
			
		||||
            case RING_CHK:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user