Esempio n. 1
0
// Will be called when WiFi station was connected to AP
void connectOk()
{
	Serial.println("I'm CONNECTED");

	startFTP();
	startWebServer();
}
Esempio n. 2
0
// Will be called when WiFi station was connected to AP
void connectOk()
{
	Serial.println("I'm CONNECTED");
	Serial.println(WifiStation.getIP().toString());
	startWebServer();
	readAD7747();
}
Esempio n. 3
0
void connectOk()
{
	startmDNS();

	Serial.println("I'm CONNECTED");
	startWebServer();
	clockClient = new ntpClientSystem();
}
Esempio n. 4
0
void CIMainWindow::on_actionStart_triggered()
{
    ui->actionStart->setEnabled(false);
    ui->actionStop->setEnabled(true);

    startWebServer();
    checkUpdateRegularly();
}
Esempio n. 5
0
// Will be called when WiFi station was connected to AP
void connectOk()
{
	Serial.println("I'm CONNECTED");

	if (!fileExist("index.html") || !fileExist("bootstrap.css.gz") || !fileExist("jquery.js.gz"))
	{
		// Download server content at first
		downloadTimer.initializeMs(3000, downloadContentFiles).start();
	}
	else
	{
		startWebServer();
	}
}
Esempio n. 6
0
void connectOk()
{
	debugf("connected");
	WifiAccessPoint.enable(false);
	lcd.clear();
	lcd.print("\7 ");
	lcd.print(WifiStation.getIP().toString());
	// Restart main screen output
	procTimer.restart();
	displayTimer.stop();

	startWebClock();
	// At first run we will download web server content
	if (!fileExist("index.html") || !fileExist("config.html") || !fileExist("api.html") || !fileExist("bootstrap.css.gz") || !fileExist("jquery.js.gz"))
		downloadContentFiles();
	else
		startWebServer();
}
Esempio n. 7
0
void init()
{
	spiffs_mount(); // Mount file system

	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(true); // Enable debug output to serial

	AppSettings.load();

	pinMode(GREEN_LED_PIN, OUTPUT);
	pinMode(RED_LED_PIN, OUTPUT);
	pinMode(SWITCH_PIN, INPUT);

	WifiStation.enable(true);
	WifiStation.enableDHCP(true);

	sendDataTimer.initializeMs(1000, sendData);
	sleepTimer.initializeMs(1000, sleeping);

	configMode = false;
	successSent = false;

	String currentNetwork = WifiStation.getSSID();
	String currentPassword = WifiStation.getPassword();


	if (digitalRead(SWITCH_PIN) || currentNetwork.length() == 0 || currentPassword.length() == 0)
	{
		debounceTimer.initializeMs(1200, debounceReset);
		configTimer.initializeMs(1000, switchDelay);

		//attachInterrupt(SWITCH_PIN, switchPressed, RISING);

		startWebServer();
		WifiStation.startScan(networkScanCompleted);
		WifiAccessPoint.config("iot-meets-business", "", AUTH_OPEN); // AUTH_WPA_WPA2_PSK
		setConfigMode();
	}
	else
	{
		WifiStation.waitConnection(connectOk, 5, connectFail);
	}

}
Esempio n. 8
0
void connectFail()
{
	debugf("connection FAILED");
	WifiAccessPoint.config("MeteoConfig", "", AUTH_OPEN);
	WifiAccessPoint.enable(true);
	// Stop main screen output
	procTimer.stop();
	displayTimer.stop();
	lcd.clear();

	lcd.setCursor(0,0);
	lcd.print("WiFi MeteoConfig");
	lcd.setCursor(0,1);
	lcd.print("  ");
	lcd.print(WifiAccessPoint.getIP());

	startWebServer();
	WifiStation.waitConnection(connectOk); // Wait connection
}
Esempio n. 9
0
void init()
{
	spiffs_mount(); // Mount file system, in order to work with files
	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(false);
	Serial.commandProcessing(false);

	//SET higher CPU freq & disable wifi sleep
	system_update_cpu_freq(SYS_CPU_160MHZ);
	wifi_set_sleep_type(NONE_SLEEP_T);

	ActiveConfig = loadConfig();

	// Attach Wifi events handlers
	WifiEvents.onStationDisconnect(STADisconnect);
	WifiEvents.onStationGotIP(STAGotIP);

	startWebServer();

	counterTimer.initializeMs(1000, counter_loop).start();
}
Esempio n. 10
0
void downloadContentFiles()
{
	if (downloadClient.isProcessing()) return; // Please, wait.

	if (downloadClient.isSuccessful())
		dowfid++; // Success. Go to next file!
	downloadClient.reset(); // Reset current download status

	if (dowfid == 0)
		downloadClient.downloadFile("http://simple.anakod.ru/templates/index.html");
	else if (dowfid == 1)
		downloadClient.downloadFile("http://simple.anakod.ru/templates/bootstrap.css.gz");
	else if (dowfid == 2)
		downloadClient.downloadFile("http://simple.anakod.ru/templates/jquery.js.gz");
	else
	{
		// Content download was completed
		downloadTimer.stop();
		startWebServer();
	}
}
Esempio n. 11
0
void App::onInit() {
    GApp::onInit();
	renderDevice->setSwapBuffersAutomatically(true);
    
    showRenderingStats    = false;
    m_showWireframe       = false;

    // May be using a web browser on the same machine in the foreground
    setLowerFrameRateInBackground(false);
    setFrameDuration(1.0f / 30);

    m_scene = Scene::create();

    makeGBuffer();
    makeGUI();

    developerWindow->videoRecordDialog->setCaptureGui(false);
    developerWindow->setVisible(false);
    developerWindow->sceneEditorWindow->setVisible(false);
    developerWindow->cameraControlWindow->setVisible(false);

    developerWindow->cameraControlWindow->moveTo(Point2(developerWindow->cameraControlWindow->rect().x0(), 0));
    m_finalBuffer = Texture::createEmpty("App::m_finalBuffer", renderDevice->width(), renderDevice->height(), ImageFormat::RGB8(), Texture::DIM_2D); 
    m_finalFramebuffer = Framebuffer::create(m_finalBuffer);
    //loadScene(developerWindow->sceneEditorWindow->selectedSceneName());
    loadScene("G3D Sponza");

    
    setActiveCamera(m_debugCamera);



    startWebServer();

    m_font = GFont::fromFile(System::findDataFile("arial.fnt"));
    const NetAddress serverAddress(NetAddress::localHostname(), WEB_PORT);
    m_addressString = serverAddress.toString();
    m_qrTexture = qrEncodeHTTPAddress(serverAddress);
    debugPrintf("Server Address: %s\n", serverAddress.toString().c_str());
}
Esempio n. 12
0
void init() {
	pinMode(PIN_BUTTON, INPUT);
	pinMode(PIN_GREEN, OUTPUT);
	pinMode(PIN_BLUE, OUTPUT);
	pinMode(PIN_RED, OUTPUT);
	digitalWrite(PIN_GREEN,0); //Green
	digitalWrite(PIN_BLUE,0); //Blue
	digitalWrite(PIN_RED,0); //Red

	indicationTimer.initializeMs(50, indicationFunction).start(); // every 20 seconds
	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(true); // Debug output to serial

	
	// mount spiffs
	int slot = rboot_get_current_rom();
#ifndef DISABLE_SPIFFS
	if (slot == 0) {
#ifdef RBOOT_SPIFFS_0
		debugf("trying to mount spiffs at %x, length %d", RBOOT_SPIFFS_0 , SPIFF_SIZE);
		spiffs_mount_manual(RBOOT_SPIFFS_0, SPIFF_SIZE);
#else
		debugf("trying to mount spiffs at %x, length %d", 0x100000, SPIFF_SIZE);
		spiffs_mount_manual(0x100000, SPIFF_SIZE);
#endif
	} else {
#ifdef RBOOT_SPIFFS_1
		debugf("trying to mount spiffs at %x, length %d", RBOOT_SPIFFS_1 , SPIFF_SIZE);
		spiffs_mount_manual(RBOOT_SPIFFS_1, SPIFF_SIZE);
#else
		debugf("trying to mount spiffs at %x, length %d", SPIFF_SIZE);
		spiffs_mount_manual(0x300000, SPIFF_SIZE);
#endif
	}
#else
	debugf("spiffs disabled");
#endif
	AppSettings.load();

	WifiAccessPoint.enable(false);
	// connect to wifi
	WifiStation.config(WIFI_SSID, WIFI_PWD);
	WifiStation.enable(true);
	
	if (AppSettings.exist())
	{
		WifiStation.config(AppSettings.ssid, AppSettings.password);
		if (!AppSettings.dhcp && !AppSettings.ip.isNull())
			WifiStation.setIP(AppSettings.ip, AppSettings.netmask, AppSettings.gateway);
	}
	mqtt = new MqttClient(AppSettings.mqtt_server,AppSettings.mqtt_port, onMessageReceived);

	WifiStation.startScan(networkScanCompleted);

	// Start AP for configuration
	WifiAccessPoint.enable(true);
	WifiAccessPoint.config("Sming Configuration "+ WifiStation.getMAC(), "", AUTH_OPEN);

	// Run WEB server
	startWebServer();
	
	Serial.printf("\r\nCurrently running rom %d.\r\n", slot);
	Serial.println("Type 'help' and press enter for instructions.");
	Serial.println();
	
	Serial.setCallback(serialCallBack);
	// Run our method when station was connected to AP (or not connected)
	WifiStation.waitConnection(connectOk, 20, connectFail); // We recommend 20+ seconds for connection timeout at start
}
Esempio n. 13
0
// Will be called when WiFi station was connected to AP
void connectOk() {
	Serial.println("I'm CONNECTED");
	Serial.println(WifiStation.getIP().toString());
	startWebServer();
	//readPeriodically();
}
Esempio n. 14
0
void connectOk(IPAddress ip, IPAddress mask, IPAddress gateway) {
//void connectOk() {
	String ipString = WifiStation.getIP().toString();
	Serial.println("I'm CONNECTED to AP_SSID=" + wifi_sid.get(currWifiIndex) + " IP: " + ipString);
	//String ipString = ip.toString();
	Serial.println("IP: " + ipString);

	startWebServer();

	if (ipString.equals("192.168.1.115") || ipString.equals("192.168.1.110")) {
// distance sensor
		Serial.println("MODE: LEUZE Distance sensor");
		udp.listen(udpServerPort);

		Serial.begin(57600);
		deltat = 100000;
		system_uart_swap();
		delegateDemoClass.begin();
		reportTimer.initializeMs(100, reportAnalogue).start();

	} else if (ipString.equals("192.168.1.113") || ipString.equals("192.168.1.112") || ipString.equals("192.168.1.21")
			|| ipString.equals("192.168.43.154")) {    //
// 4 axis stepper driver
		Serial.setCallback(serialCallBack);
		Serial.println("MODE: 4 Axis Stepper driver");

		Serial.println("Init ended.");
		Serial.println("Type 'help' and press enter for instructions.");
		Serial.println();

		deltat = 2000;

		if (ipString.equals("192.168.1.112"))
			parseGcode("reassign x=0 y=3 e=1 z=2");
		else if (ipString.equals("192.168.1.113"))
			parseGcode("reassign x=0 y=1 e=3 z=2");

		reportTimer.initializeMs(300, reportStatus).start();
		hardwareTimer.initializeUs(deltat, StepperTimerInt);
		hardwareTimer.startOnce();
	} else if (ipString.equals("192.168.1.116")) {
		Serial.println("MODE: Encoder driver");
		pinMode(encoder0PinA, INPUT);
		digitalWrite(encoder0PinA, HIGH);       // turn on pullup resistor
		pinMode(encoder0PinB, INPUT);
		digitalWrite(encoder0PinB, HIGH);       // turn on pullup resistor

		attachInterrupt(encoder0PinA, doEncoderA, GPIO_PIN_INTR_ANYEDGE);
		attachInterrupt(encoder0PinB, doEncoderB, GPIO_PIN_INTR_ANYEDGE);

		reportTimer.initializeMs(100, reportEncoderPosition).start();
	} else if (ipString.equals("192.168.1.117")) {
		Ltc2400Spi = new SPISoft(PIN_DO, PIN_DI, PIN_CK, PIN_SS);
		Ltc2400Spi->begin();
		reportTimer.initializeMs(300, readFromLTC2400).startOnce();
	}
	else
	{
		Serial.setCallback(serialCallBack);
	}

}
Esempio n. 15
0
// Will be called when system initialization was completed
void ICACHE_FLASH_ATTR startServers()
{
	startFTP();
	startWebServer();
}