I've been trying to figure this problem out myself to long. Sleeping issues but only at night. I lay down at night and medicated or not my legs, use to be mainly the left one now it is the right one, gets a little jolt of tingly like electricity down my leg into my knee usually and builds for a second and then leg jerk. Which is puzzling me because afternoon nap no problems. Skip afternoon nap night doesn't change.
Sometimes using the pedal exercised or a hot shower or soak helps. But it's getting really aggravating that it keeps continuing. I have to knee with my knees bent as much as possible for my leg to not jerk. And it may be like that for an hour or more.
Medication and supplements:
Carb/levo 25/100 rapid release, 50/200 duration release, amantadine before bed.
Magnesium
Sometimes I would have to take a second 25/100 if after an hour it didn't d settle down and wait another hour for medication to take complete effect.
DBS: Doctor today change one leads section active and the old off. To help with left leg gait that was hindered. These are the Medtronic brand DBS.