Can't connect to photon, breathing green

My photon has started to breath green, I removed it from known devices, and now it doesn’t show on wifi so i can’t set it up with my iPhone, when i disconnect/reconnect it, it just breathes green after a while.

What code did you have on it?
Have you tried Safe Mode?
For mobile app setup you’d need to put it into Listening Mode.

doesn’t show up in wifi even when in safe mode, the last time i flashed it (before i couldn’t because of breathing green led) it had this on it: http://pastebin.com/YLV3T02B

edit: i put it into listening mode, it’s now back with my devices

edit2: could load the blink test app, works fine, when i flash the above link it goes back to breathing green. Also now it doesn’t blink magenta when i click flash, so i suspect i’m not flashing it

But this line in your code might cause troubles, since it prevents the device to do cloud service.

 while (!Serial.available());

You need to change it this way

  while (!Serial.available())
    Particle.process();

and I’d add some timeout to the while() too.

that seems to have done the trick, but the code doesn’t come out of that while, how do I make Serial.avaible() true?

If you don't know how to get out of it, why have you got it in there in the first place?

This usually only gets put there to ensure you are ready to watch the serial output in your serial monitor since it waits for you to enter something into your serial monitor before continuing.
So if you never did that you might even get rid of the whole while().

And exactly this was the reason for this before