What did I do wrong with this integral problem? 
Find the value of the following definite integral
$$\int_0^{\pi/2} \sqrt{1 - \sqrt{3}\sin 2x + 2\cos^2x} \, dx$$


*

*My attempt:

$$\int_0^{\pi/2} \sqrt{1 - \sqrt{3}\sin 2x + 2\cos^2x} \, dx$$
$$= \int_0^{\pi/2} \sqrt{2 - \sqrt{3}\sin 2x + \cos2x} \, dx$$
$$= \int_0^{\pi/2} \sqrt{2 + 2\cos \left(2x + \dfrac{\pi}{3}\right)} \, dx$$
$$= \sqrt{2} \int_0^{\pi/2} \sqrt{1 + \cos \left(2x + \dfrac{\pi}{3}\right)} \, dx$$
Let $u = 1 - \cos \left(2x + \dfrac{\pi}{3}\right) \implies du = 2\sin \left(2x + \dfrac{\pi}{3}\right) \, dx = 2\sqrt{2u - u^2} \, dx \implies dx = \dfrac{1}{2\sqrt{2u - u^2}} \, du$
The integral become:
$$\sqrt{2}\int_{1/2}^{3/2} \dfrac{\sqrt{2-u}}{2\sqrt{2u - u^2}} \, du$$
$$= \sqrt{2}\int_{1/2}^{3/2} \dfrac{1}{2\sqrt{u}} \, du$$
$$= \sqrt{2} \cdot \left(\sqrt{u}\right) \Biggr|_{1/2}^{3/2} = \sqrt{3} - 1$$
However, using my calculator and other online calculators, they're all giving $3 - \sqrt{3}$, which is different from mine.
So what did I do wrong?
A small realization I found out is that:
$$\text{(Calculator answer) = $\sqrt{3} \cdot$ (My answer)}$$

$$\int_0^{\pi/2}\sqrt{1-\sqrt{3}\sin(2x)+2\cos^2(x)}dx$$
then as you did we know that:
$$\cos(2x)=2\cos^2(x)-1\Rightarrow 2\cos^2(x)=\cos(2x)+1$$
so we have:
$$\int_0^{\pi/2}\sqrt{2-\sqrt{3}\sin(2x)+\cos(2x)}dx$$
try substituting $u=2x\Rightarrow dx=du/2$ so:
$$\int_0^\pi\sqrt{2-\sqrt{3}\sin(u)+\cos(u)}\frac{du}2$$
now set up
$$\sqrt{3}\sin(u)+\cos(u)=A\cos(u+\alpha)$$
solving gives $2\cos\left(x-\frac\pi3\right)$
now we have:
$$\frac1{\sqrt{2}}\int_0^\pi\sqrt{1-\sin\left(u-\frac\pi3\right)}du$$
letting $v=u-\frac\pi3\Rightarrow dv=du$ we get:
$$\frac1{\sqrt{2}}\int\limits_{-\pi/3}^{2\pi/3}\sqrt{1-\sin v}\,dv$$
