I am assuming the lights are 12 VDC. First question is whether the lights have a fast, more or less continuous flicker, or whether the flicker is occasional. When the lights dim, how long do they dim for?
On the 12 V side, flicker is almost always caused by voltage fluctuations. Have you plugged the trailer into house power? If the flicker does continue, you know it's not the generator. If the flicker is occasional, I would be looking at something coming on, drawing power and dropping the voltage.
You mentioned there is no flicker when the battery is disconnected. This suggests to me that the problem 'may involve the battery charger in the controller.
This is a case where a digital volt meter is close to useless. The update in the counter can miss fast voltage changes. An analogue style volt meter will better indicate a voltage change by the needle moving.
More observations would help
-is the flicker continuous, or only now and then
-does it happen when plugged into shore power, or only on the generator
-do all the lights flicker, or on some of them
-if the battery is disconnected, is there still flicker
Don't forget the grounds when checking connections.