It is never explained how Megatron was able to located the Autobot secret base. While the Decepticons were able to narrow it down to Jasper, they never did explain how they found its exact location in Darkest Hour. This episode provides an answer as it is possible that Megatron located the Autobot's secret base when using the cortical psychic patch on Smokescreen which means that he saw all of Smokescreen's memories which contains the location of the Autobot's secret base. Unlike the previous episodes featuring the cortical psychic patch, this episode doesn't show us all of the time Megatron spent in Smokescreen's head and instead shows us the end of it with Megatron already in the base watching the Smokescreen memory play out. So it is possible that Megatron found the Autobot secret base through this method.