refactor(cpn): Support JSON radio hardware definitions (#4406)
This commit is contained in:
@@ -41,6 +41,7 @@
|
||||
#include "storage.h"
|
||||
#include "translations.h"
|
||||
#include "version.h"
|
||||
#include "boardfactories.h"
|
||||
|
||||
using namespace Simulator;
|
||||
|
||||
@@ -276,6 +277,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
Q_INIT_RESOURCE(hwdefs);
|
||||
gBoardFactories = new BoardFactories();
|
||||
registerStorageFactories();
|
||||
registerOpenTxFirmwares();
|
||||
SimulatorLoader::registerSimulators();
|
||||
@@ -293,7 +296,7 @@ int main(int argc, char *argv[])
|
||||
simOptions.firmwareId = g.profile[profileId].fwType();
|
||||
}
|
||||
|
||||
// do not used saved simulatorId always refresh
|
||||
// DO NOT use saved simulatorId as could be changed in later releases
|
||||
simOptions.simulatorId = SimulatorLoader::findSimulatorByName(Firmware::getFirmwareForId(simOptions.firmwareId)->getSimulatorId());
|
||||
|
||||
if (simOptions.dataFolder.isEmpty())
|
||||
@@ -343,6 +346,11 @@ int main(int argc, char *argv[])
|
||||
g.sessionId(profileId);
|
||||
g.simuLastProfId(profileId);
|
||||
|
||||
// TODO: fix this in Firmware and Boards refactor
|
||||
// Append a dummy variant to firmware name to force the Board Type to be registered
|
||||
Firmware * simfw = Firmware::getFirmwareForId(simOptions.firmwareId + "-simulator");
|
||||
delete simfw;
|
||||
|
||||
// Set global firmware environment
|
||||
Firmware::setCurrentVariant(Firmware::getFirmwareForId(simOptions.firmwareId));
|
||||
//qDebug() << "current firmware:" << getCurrentFirmware()->getId();
|
||||
@@ -375,6 +383,7 @@ int finish(int exitCode)
|
||||
SimulatorLoader::unregisterSimulators();
|
||||
unregisterOpenTxFirmwares();
|
||||
unregisterStorageFactories();
|
||||
gBoardFactories->unregisterBoardFactories();
|
||||
|
||||
#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
|
||||
SDL_Quit();
|
||||
|
||||
Reference in New Issue
Block a user