Browse Source

Fixed Anchor Geo Issues

AGP
Evgeny Gagua 3 years ago
parent
commit
e75b7096c4
  1. 14
      Projects/la_mojo/build
  2. BIN
      Projects/starProcDaemon/Release/starProcDaemon
  3. 65
      lib/App/common/SQLite_dataBinder.cpp
  4. 1
      lib/App/common/SQLite_dataBinder.h
  5. 2
      lib/App/common/dataBinder_structures.h
  6. 6
      lib/App/common/deviceNode2D.cpp
  7. 2
      lib/App/common/deviceNode2D.h
  8. 35
      lib/App/common/hardwareResourceSerialProvider.cpp
  9. 4
      lib/App/mojo/mojoKernel.cpp

14
Projects/la_mojo/build

@ -1,11 +1,11 @@
#! /bin/sh
make clean -e "CFG=Debug86"
make -e "CFG=Debug86" -j4
#make clean -e "CFG=Debug"
make -e "CFG=Debug" -j6
make clean -e "CFG=Release86"
make -e "CFG=Release86" -j4
cd Release86
strip ./mojo
cd ..
#make clean -e "CFG=Release86"
#make -e "CFG=Release86" -j4
#cd Release86
#strip ./mojo
#cd ..

BIN
Projects/starProcDaemon/Release/starProcDaemon

Binary file not shown.

65
lib/App/common/SQLite_dataBinder.cpp

@ -2282,6 +2282,71 @@ uint32_t sqliteDBC::getResourceID( uint32_t NodeID, uint8_t type, uint32_t auxID
};
return RetVal;
};
DBC_SITE_DATA *sqliteDBC::getSiteData( uint32_t ID ){
DBC_SITE_DATA * tVal = NULL;
if( m_bStoIsConnected ){
char tQBuf[CTEXT];
AAssoc *result;
sprintf(tQBuf, "SELECT * FROM `system_props` WHERE `id`=%d", ID);
#ifdef DEBUG
LOG(tQBuf);
#endif
result = m_pDataStorage->Query( tQBuf );
if( result!= NULL ) {
if( result->size() > 0 ) {
Assoc *cArr;
tVal = (DBC_SITE_DATA*) malloc(sizeof(DBC_SITE_DATA));
if( tVal != NULL ) {
memset( tVal, 0 , sizeof(DBC_SITE_DATA));
Assoc::iterator it;
cArr = result->at(0);
it = cArr->find("type");
if( it != cArr->end() ){
tVal->account_id = atoi( it->second.c_str() );
};
it = cArr->find("name");
if( it != cArr->end() ){
sprintf( tVal->name, it->second.c_str() );
};
//it = cArr->find("server_ident");
//if( it != cArr->end() ){
// sprintf( tVal->ident, it->second.c_str() );
//};
it = cArr->find("anchor_lat");
if( it != cArr->end() ){
tVal->lat = atof( it->second.c_str() );
};
it = cArr->find("anchor_lon");
if( it != cArr->end() ){
tVal->lon = atof( it->second.c_str() );
};
it = cArr->find("anchor_alt");
if( it != cArr->end() ){
tVal->alt = atof( it->second.c_str() );
};
it = cArr->find("hemisphere");
if( it != cArr->end() ){
tVal->SH = ( it->second.c_str()[0] == 'S' );
};
it = cArr->find("map_id");
if( it != cArr->end() ){
tVal->map_id = atoi( it->second.c_str() );
};
it = cArr->find("local_binding");
if( it != cArr->end() ){
tVal->local_binding = (bool) atoi(it->second.c_str());
};
it = cArr->find("work_mode");
if( it != cArr->end() ){
tVal->work_mode = atoi(it->second.c_str());
};
};
};
};
deleteResult( result );
};
return tVal;
};
uint32_t sqliteDBC::getServerID( CSTR identity ){
uint32_t RetVal = 0;

1
lib/App/common/SQLite_dataBinder.h

@ -137,6 +137,7 @@ class sqliteDBC: public dataBinder {
virtual DBC_PUSHED_CMD * getNodePushedCMD( uint32_t NodeID );
virtual DBC_RESOURCE_DATA * getResourceData( uint32_t ResourceID );
virtual uint32_t getResourceID( uint32_t NodeID, uint8_t type, uint32_t auxID );
virtual DBC_SITE_DATA * getSiteData( uint32_t ID );
virtual uint32_t getServerID( CSTR identity );
virtual uint32_t getServerNode( uint32_t SID );
virtual DBC_TARGET_FLITER_DATA *getTargetFilterData( uint32_t ID );

2
lib/App/common/dataBinder_structures.h

@ -522,6 +522,8 @@ typedef struct S_DBC_EVT_RECORD{
typedef struct S_DBC_SITE_DATA{
uint32_t account_id;
uint8_t type;
uint8_t work_mode;
char name[129];
char ident[33];
float lat;

6
lib/App/common/deviceNode2D.cpp

@ -3129,9 +3129,9 @@ TARGET_DATA *device2DSensor::prepareTargetData( uint16_t AZ, uint16_t RANGE, uin
// global - C3D_WGS84_LOC
tSystem->convertToSystem( &m_oPosition, tVal->local_target, tVal->system_target );
//ToDo: Fix Convert!
//tSystem->convertToGlobal( &m_oPosition, tVal->local_target, tVal->global_target );
tSystem->convertToGlobal( &m_oPosition, tVal->system_target, tVal->global_target );
#ifdef DEBUG_EXTRA
tSystem->convertToGlobal( &m_oPosition, tVal->local_target, tVal->global_target );
//tSystem->convertToGlobal( &m_oPosition, tVal->system_target, tVal->global_target );
#ifdef DEBUG
char tB[128];
sprintf(tB, "tCords Local: %0.3f %0.3f %0.3f", tVal->local_target.r, tVal->local_target.fi, tVal->local_target.tetta );
LOG( tB );

2
lib/App/common/deviceNode2D.h

@ -23,7 +23,7 @@
#define LGS_DEFAULT_SLEEP_TIME 100
#define LGS_ALERT_SLEEP_TIME 10
#define LGS_DEFAULT_TO_COUNTER 10 //100ms
#define LGS_DEFAULT_WS_TIME 1 //10ms
#define LGS_DEFAULT_WS_TIME 6 //60ms
#define LGS_INITIAL_FLIPS 8
#define LGS_CMD_RETRY_COUNT 3

35
lib/App/common/hardwareResourceSerialProvider.cpp

@ -451,10 +451,19 @@ bool hardwareResourceSerialProvider::create_HW(){
//m_iFID = open( DevicePath, O_RDWR| O_NONBLOCK | O_NDELAY );
#ifdef __arm__
LOG("ARM Defined!");
#else
LOG("ARM NOT Defined!");
#endif
#ifdef RASPI_HARDWARE
LOG("RASPI_HARDWARE Defined!");
#endif
#ifdef __aarch64__
LOG("AARCH64 Defined!");
#endif
#ifdef USE_WIRINGX
LOG("USE_WIRINGX Defined!");
LOG( WIRINGX_PLATFORM );
#endif
#ifdef USE_WIRINGPI
LOG("USE_WIRINGPI Defined!");
if( strstr( m_sUartData.path, "USB" ) == NULL ){
#ifdef DEBUG
LOG("MANUAL RTS CTL(R)");
@ -493,10 +502,9 @@ bool hardwareResourceSerialProvider::create_HW(){
#else
#ifdef DEBUG
//LOG("NO MANUAL RTS CTL(_)");
LOG("TEST MANUAL RTS CTL(INTEL)");
LOG("NO MANUAL RTS CTL(INTEL)");
#endif
m_bManualRTS = true;
m_bManualRTS = false;
#endif
#endif
@ -1253,10 +1261,11 @@ int hardwareResourceSerialProvider::sendBlock(unsigned char* Data, int DataSize)
// setRTS( 1 );
do{
if( m_bManualRTS ) {
//#if defined( USE_WIRINGPI ) || defined( USE_WIRINGX )
// digitalWrite( 0, HIGH );
//#endif
#if defined( USE_WIRINGPI ) || defined( USE_WIRINGX )
digitalWrite( 0, HIGH );
#else
setRTS( 1 );
#endif
};
RetVal = write( m_iOutFID, Data, DataSize);
if( m_bManualRTS ){
@ -1264,10 +1273,12 @@ int hardwareResourceSerialProvider::sendBlock(unsigned char* Data, int DataSize)
do {
int r = ioctl( m_iOutFID, TIOCSERGETLSR, &lsr );
} while (!(lsr & TIOCSER_TEMT));
//#if defined( USE_WIRINGPI ) || defined( USE_WIRINGX )
// digitalWrite( 0, LOW);
//#endif
setRTS( 0 );
#if defined( USE_WIRINGPI ) || defined( USE_WIRINGX )
digitalWrite( 0, LOW );
#else
setRTS( 0 );
#endif
};
if( RetVal == DataSize ){
usleep( 10 );

4
lib/App/mojo/mojoKernel.cpp

@ -148,14 +148,14 @@ bool mojoKernel::create(){
sprintf( tBuffer,"Server Registered as [%d] nodeID[%d]",m_nServerID, m_nServerNodeID );
LOG( tBuffer );
DBC_SITE_DATA *tSiteData = m_pDBC->getSiteData( m_nInstanceID );
DBC_SITE_DATA *tSiteData = m_pDBC->getSiteData( 1 );
if( tSiteData ) {
C3D_WGS84_LOC t;
t.lat = tSiteData->lat;
t.lon = tSiteData->lon;
t.alt = tSiteData->alt;
m_pSystemAnchor = systemAnchor::getInstance( tSiteData->SH, &t, tSiteData->local_binding );
m_pSystemAnchor = systemAnchor::getInstance( tSiteData->SH, &t, false );//tSiteData->local_binding );
free( tSiteData );
} else {
LOG_ERROR("Error Loading Site DATA!");

Loading…
Cancel
Save