 // nunchuk
 ArduinoNunchuk nunchuk = ArduinoNunchuk();
 bool nunchukControlMode = false;
-bool nunchukControlJustEntered = false;
-bool nunchukControlJustExited = false;
 
 void nunchukControlModeToggle(void) {
 	nunchukControlMode = !nunchukControlMode;
 	if (nunchukControlMode) {
 		sendMsgF(MSG_NCM_ON);
 		messageScrollSet("NCM+");
-		nunchukControlJustEntered = true;
 	} else {
 		sendMsgF(MSG_NCM_OFF);
 		messageScrollSet("NCM-");
-		nunchukControlJustExited = true;
 	}
 	messageScrollUpdate(true);
 }

		return true;
	return false;
}
#define NUNCHUK_SWEEP_SCALE DEFAULT_SERVO_SWEEP_SPEED / 2

void nunchukControlModeUpdate() {
	nunchuk.update();
	// the Z-Button disables nunchukcontrolmode
	// but only if we didn't just enable it
	//	i.e. it is still pressed from enabling the mode
	if (nunchuk.zButton)
		if (!nunchukControlJustEntered && !nunchukControlJustExited)
			nunchukControlModeToggle();
	else  {
		nunchukControlJustEntered = false;
		nunchukControlJustExited = false;

		Serial.print("update\n");
		if (!nunchukControlMode)
			return;
		// if the stick is centered, hold the current position
		if (nunchukControlIsDeadzone(nunchuk.analogX)) {
			moveServo(servoRot, widgetRot, servoRot.read(), 10, false, true);
			Serial.print("deadzone\n");
		} else if (nunchuk.analogX < 127) {
			// rotate
			moveServo(servoRot, widgetRot, 0, (127 - nunchuk.analogX) / NUNCHUK_SWEEP_SCALE, false, true);
			Serial.print("less\n");
		} else {
			moveServo(servoRot, widgetRot, 180, (nunchuk.analogX - 127) / NUNCHUK_SWEEP_SCALE, false, true);
			Serial.print("more\n");
		}
		if (nunchukControlIsDeadzone(nunchuk.analogY)) {
			moveServo(servoL, widgetL, servoL.read(), 10, true, true);
			moveServo(servoR, widgetR, servoR.read(), 10, true, true);
		}
	}
}

		if (cycles == CYCLES_RESET_COUNT)
			cycles = 0;

		// if we are in the nunchuk control mode run the update code
		if (nunchukControlMode)
			nunchukControlModeUpdate();
	}
}
