It is a powder tester. (That is not a WAG!)
A charge was placed in the pan (as in a flintlock gun). When the cock fell, the sparks were directed into the pan, blowing the pan cover open. The distance the cover was moved determined the quality of the powder, either as a number or for comparison with a powder of a known quality.
In that era, powder was not a "given" as to quality as it is today. It ranged from excellent to floor sweepings, so a person who sold powder and whose reputation would depend on its quality, would test each new batch. Also, military installations that loaded cartridges (the paper kind) also tested each batch of powder.
One might think powder testers would have been in common use so folks who wanted to make sure of the quality of their powder could do their own testing, but in fact that was not very common and the devices are rare, not something found in every shooter's gun room.
Jim