set another sprite at the same position of the cannon, set its angle towards mouse position.
Set the cannon angle to the sprites angle but with a condition where you check if its in your angle range.
I think there is an more effiecent way but i dont worked a lot with angles yet so this is the only methode that comes in my mind right now.
Maybe someone other knows a better way for it.