the battery is slowly going bad, so its putting out less power until you rev the motor or drive it, which means when the engine turns faster the alternator produces charge to the battery which gives it temporarily more power, so when at idle the battery's power is weak and there is a censor detecting it, you probably should buy a new battery before your stranded.