@@ -570,9 +628,6 @@ function loggerConfigFromXML($confXML){
}
}
return$conf;
return$conf;
}
}
functioninit_default_config(){
functioninit_default_config(){
$default_config=array(
$default_config=array(
'imu_period'=>'auto',// 0xFFFFFFFF, // 0 - off, >=0xff000000 - "when ready", else - number of SCLK periods
'imu_period'=>'auto',// 0xFFFFFFFF, // 0 - off, >=0xff000000 - "when ready", else - number of SCLK periods
@@ -620,26 +675,40 @@ function init_default_config(){
0x0e,// temperature
0x0e,// temperature
0x70,// time m/s
0x70,// time m/s
0x72,// time d/h
0x72,// time d/h
0x74// time y/m
0x74
),
)// time y/m
,
'nmea'=>array(
'nmea'=>array(
// / first three letters - sentence to log (letters after "$GP"). next "n"/"b" (up to 24 total) - "n" number (will be encoded 2 digits/byte, follwed by "0xF"
// / first three letters - sentence to log (letters after "$GP"). next "n"/"b" (up to 24 total) - "n" number (will be encoded 2 digits/byte, follwed by "0xF"
// / "b" - byte - all but last will have MSB 0 (& 0x7f), the last one - with MSB set (| 0x80). If there are no characters in the field 0xff will be output
// / "b" - byte - all but last will have MSB 0 (& 0x7f), the last one - with MSB set (| 0x80). If there are no characters in the field 0xff will be output
array('RMC','nbnbnbnnnnb'),
array(
array('GGA','nnbnbnnnnbnbbb'),
'RMC',
array('GSA','bnnnnnnnnnnnnnnnn'),
'nbnbnbnnnnb'
array('VTG','nbnbnbnb')
),
),
'message'=>'Odometer message'// Message - up to 56 bytes
array(
);
'GGA',
'nnbnbnnnnbnbbb'
),
array(
'GSA',
'bnnnnnnnnnnnnnnnn'
),
array(
'VTG',
'nbnbnbnb'
)
),
'message'=>'Odometer message'
)// Message - up to 56 bytes
;
return$default_config;
return$default_config;
}
}
/**
/**
Combines $conf and $dflt arrays - all driver parameters are overwritten aftre the call
* Combines $conf and $dflt arrays - all driver parameters are overwritten aftre the call
$binfile="/var/imu_config.bin";// comment out if not needed - debug feature
if(isset($b_index[103696])){
if(isset($b_index[103696])){
$baud=$ids[$b_index[103696]]['baud'];
$baud=$ids[$b_index[103696]]['baud'];
if($baud===0)
if($baud===0)
@@ -151,9 +152,13 @@ if (isset ( $logger_config )) {
$noGPS=($compass||$GPS)?"":"noGPS";
$noGPS=($compass||$GPS)?"":"noGPS";
$nocompass=($compass)?"":"nocompass";
$nocompass=($compass)?"":"nocompass";
// Just debugging:
// Just debugging:
//$nocompass = "";
$nocompass="";
/*
* Actually there is a problem - when compass is disabled, imgsrv incorrectly decodes meta (image number, sensor number)
* Even if re-srated after running exif.php
*/
$cmd=$exif_php." init $noGPS$nocompass";
$cmd=$exif_php." init $noGPS$nocompass";
if($verbose)
if($verbose)
@@ -468,8 +473,7 @@ function init_default_config() {
0x70,// time m/s
0x70,// time m/s
0x72,// time d/h
0x72,// time d/h
0x74
0x74
)// time y/m
),// time y/m
,
'nmea'=>array(
'nmea'=>array(
// / first three letters - sentence to log (letters after "$GP"). next "n"/"b" (up to 24 total) - "n" number (will be encoded 4 digits/byte, follwed by "0xF"
// / first three letters - sentence to log (letters after "$GP"). next "n"/"b" (up to 24 total) - "n" number (will be encoded 4 digits/byte, follwed by "0xF"
// / "b" - byte - all but last will have MSB 0 (& 0x7f), the last one - with MSB set (| 0x80). If there are no characters in the field 0xff will be output
// / "b" - byte - all but last will have MSB 0 (& 0x7f), the last one - with MSB set (| 0x80). If there are no characters in the field 0xff will be output
@@ -491,8 +495,8 @@ function init_default_config() {
)
)
),
),
'message'=>'Odometer message'
'message'=>'Odometer message'
)// Message - up to 56 bytes
);// Message - up to 56 bytes
;
return$default_config;
return$default_config;
}
}
/**
/**
@@ -539,7 +543,7 @@ function combineLoggerConfigs($new_conf, $dflt = null) {
return$conf;
return$conf;
}
}
functionsetup_IMU_logger($conf){
functionsetup_IMU_logger($conf){
global$verbose;
global$verbose,$binfile;
// $xclk_freq=80000000; // 80 MHz in NC353
// $xclk_freq=80000000; // 80 MHz in NC353
$xclk_freq=100000000;// 100 MHz in NC393
$xclk_freq=100000000;// 100 MHz in NC393
$data=array();
$data=array();
@@ -610,12 +614,12 @@ function setup_IMU_logger($conf) {
// / (DFLT_SLAVE_ADDR << 24))
// / (DFLT_SLAVE_ADDR << 24))
$logger_conf|=($conf['slow_spi']&0x1)<<23;
$logger_conf|=($conf['slow_spi']&0x1)<<23;
$logger_conf|=($conf['imu_sa']&0x7)<<24;
$logger_conf|=($conf['imu_sa']&0x7)<<24;
$data[$index++]=$logger_conf&0xff;
$data[$index++]=$logger_conf&0xff;// DWORD 0x03
$data[$index++]=($logger_conf>>8)&0xff;
$data[$index++]=($logger_conf>>8)&0xff;
$data[$index++]=($logger_conf>>16)&0xff;
$data[$index++]=($logger_conf>>16)&0xff;
$data[$index++]=($logger_conf>>24)&0xff;
$data[$index++]=($logger_conf>>24)&0xff;
// / Set time driver will go to sleep if the data is not ready yet (less than full sample in the buffer)
// / Set time driver will go to sleep if the data is not ready yet (less than full sample in the buffer)