What P0504 usually means
P0504 is more important than the plain title suggests because modern vehicles use brake-pedal information for much more than brake lamps. The PCM, ABS, cruise control, throttle logic, shift interlock, and sometimes start-stop or traction systems all want a clean brake-applied signal. This code means the controller is comparing two expected brake-switch channels and deciding they do not line up correctly. That can come from a failing brake-light switch, poor adjustment at the pedal, wiring drag, low-voltage weirdness, or a switch that works for lamps but not for the correlation logic the modules rely on.