Exemplo n.º 1
0
void loop() {
    static int disconnected;
    if (millis() - lastCheck > 3000) {
        
        if (networkStatus()) {
            digitalWrite(RED_LED,LED_OFF);
            disconnected=0;
        } else {
            digitalWrite(RED_LED,LED_ON);
            if (++disconnected > 10) {
                char tempssid[40];
                strcpy(tempssid,networkSSID);
                digitalWrite(RED_LED,networkJoin(tempssid)?LED_OFF:LED_ON);
            }
        }
        digitalWrite(GRN_LED,SerialUSB.isConnected()?HIGH:LOW);
        lastCheck=millis();
    }
        
    while (device.gotLine()) {
        handleDeviceInput();
    }
    while (console.gotLine()) {
        digitalWrite(GRN_LED,LOW);
        handleConsoleInput();
        digitalWrite(GRN_LED,HIGH);
    }
    
    Watchdog_Reset();

}
void loop() {
    static int disconnected;
	console.printf("HELLO?\r\n");
    if (millis() - lastCheck > 3000) {
        digitalWrite(RED_LED,LED_OFF);
        if ((! hasWifiModule) || networkStatus()) {
            digitalWrite(RED_LED,LED_OFF);
            disconnected=0;
        } else {
            digitalWrite(RED_LED,LED_ON);
            if (++disconnected > 10) {
                char tempssid[40];
                strcpy(tempssid,networkSSID);
                digitalWrite(RED_LED,networkJoin(tempssid)?LED_OFF:LED_ON);
            }
        }
        digitalWrite(GRN_LED,SerialUSB.isConnected()?HIGH:LOW);
        lastCheck=millis();
    }
        
    
    while (console.gotLine()) {
        digitalWrite(GRN_LED,LOW);
        handleConsoleInput();
        digitalWrite(GRN_LED,HIGH);
    }
    clearStowedValues();
    Watchdog_Reset();

}
int main(void) {
    setup();
    // should never get past setup.
    while (true) {
        serialTasks(); //move to 
        if (consoleComm.gotline) {
            handleConsoleInput(&consoleComm);
        }
#ifdef LOGGING_SERIAL_DEVICE
        if (deviceComm.gotline) {
            handleDeviceInput(&deviceComm);
        }
#endif
            
   }
    
    return 0;
    
}
Exemplo n.º 4
0
static void vMonitorTask(void* pvParameters)
{
    portTickType xLastWakeTime = xTaskGetTickCount();
    
    const portTickType xWakePeriod = 100;
    int ret;
    /* Infinite loop */
    while(true)
    {   //if(deviceComm.gotline){
//        if (xSemaphoreTake(deviceComm.xGotLineSemaphore,IN_NO_TIME_AT_ALL)){
//            handleDeviceInput(&deviceComm);
//            xSemaphoreGive(deviceComm.xGotLineSemaphore);
//        }
        if (consoleComm.gotline){
//        if (xSemaphoreTake(consoleComm.xGotLineSemaphore,IN_NO_TIME_AT_ALL)){
            ret=handleConsoleInput(&consoleComm);
//            xSemaphoreGive(consoleComm.xGotLineSemaphore);
          //  if(ret==COMMAND_FORWARDED){
//                if (xSemaphoreTake(deviceComm.xGotLineSemaphore,UNTIL_ITS_ANNOYING))  {
          //      while (!deviceComm.gotline) {
                    
           //     }
           //         handleDeviceInput(&deviceComm);
//                    xSemaphoreGive(deviceComm.xGotLineSemaphore);
                //}
            //}
         }
        //
        
        
        togglePin(GRN_LED);
        //SerialUSB.println("?");
        toConsole("?");
 //       vTaskDelay(100);
       vTaskDelayUntil(&xLastWakeTime, xWakePeriod);
    }
}
Exemplo n.º 5
0
void ConsoleSocket::OnRead()
{
    handleConsoleInput();
}