Example #1
0
bool ICACHE_FLASH_ATTR checkSmartConfig(enum SmartConfigAction action) {
	static doingSmartConfig = false;

	switch (action) {
	case SC_CHECK:
		break;
	case SC_HAS_STOPPED:
		os_printf("Finished smartConfig\n");
		stopFlash();
		doingSmartConfig = false;
		MQTT_Connect(&mqttClient);
		break;
	case SC_TOGGLE:
		if (doingSmartConfig) {
			os_printf("Stop smartConfig\n");
			stopFlash();
			smartconfig_stop();
			doingSmartConfig = false;
			wifi_station_disconnect();
			wifi_station_connect();
		} else {
			os_printf("Start smartConfig\n");
			MQTT_Disconnect(&mqttClient);
			mqttConnected = false;
			startFlash(100, true);
			doingSmartConfig = true;
			smartconfig_start(smartConfig_done, true);
		}
		break;
	}
	return doingSmartConfig;
}
Example #2
0
bool ICACHE_FLASH_ATTR toggleHttpSetupMode(void) {
	httpSetupMode = !httpSetupMode;
	if (httpSetupMode) {
		os_timer_disarm(&setup_timer);
		os_timer_setfn(&setup_timer, (os_timer_func_t *) setupCb, (void *) 0);
		os_timer_arm(&setup_timer, 10 * 60 * 1000, false); // Allow 10 minutes
		startFlash(-1, 500, 500);
	} else {
		os_timer_disarm(&setup_timer);
		stopFlash();
	}
	return httpSetupMode;
}
Example #3
0
static void ICACHE_FLASH_ATTR flashCb(void) {
	os_timer_disarm(&flash_timer);
	switch (flashState) {
	case OFF:
		easygpio_outputSet(LED, LED_OFF);
		break;
	case FLASHING_ON:
		easygpio_outputSet(LED, LED_OFF);
		os_timer_arm(&flash_timer, flashOnTime, false);
		flashState = FLASHING_OFF;
		break;
	case FLASHING_OFF:
		flashCounter--;
		if (flashCounter > 0) {
			easygpio_outputSet(LED, LED_ON);
			os_timer_arm(&flash_timer, flashOnTime, false);
			flashState = FLASHING_ON;
		} else {
			easygpio_outputSet(LED, LED_OFF);
			os_timer_arm(&flash_timer, patternOffTime, false);
			flashState = WAIT;
		}
		break;
	case WAIT:
		if (patternRepeatCount > 0)
			patternRepeatCount--;
		if (patternRepeatCount == 0) {
			stopFlash();
			if (flashFinishedCb) flashFinishedCb();
		} else { // if -ve will keep going
			easygpio_outputSet(LED, LED_ON);
			flashCounter = flashCount;
			os_timer_arm(&flash_timer, flashOnTime, false);
			flashState = FLASHING_ON;
		}
		break;
	}
}
Example #4
0
static void ICACHE_FLASH_ATTR setupCb(void) {
	httpSetupMode = false;
	stopFlash();
}
void ClientMapRectItem::flashRect()
{
	m_FlashTimer->start();
	QTimer::singleShot(2000, this, SLOT(stopFlash()));
}