diff --git a/.gitignore b/.gitignore
index 3e43eb4e..81b959f1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
*.[oa]
*.vpwhist
*.vtg
+*.out
+*.log
*~
\ No newline at end of file
diff --git a/Linux_Workspace.vpw b/Linux_Workspace.vpw
index 039ca787..fd9aa031 100644
--- a/Linux_Workspace.vpw
+++ b/Linux_Workspace.vpw
@@ -6,5 +6,6 @@
+
diff --git a/Projects/PRU_CORES/PRU_CORES.vpj b/Projects/PRU_CORES/PRU_CORES.vpj
new file mode 100644
index 00000000..3633a083
--- /dev/null
+++ b/Projects/PRU_CORES/PRU_CORES.vpj
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/hardware/soc/general/3DLRF.h b/lib/hardware/soc/general/3DLRF.h
index d064db0b..82200c1a 100644
--- a/lib/hardware/soc/general/3DLRF.h
+++ b/lib/hardware/soc/general/3DLRF.h
@@ -526,43 +526,76 @@ enum {
#define TH_SIZE_BYTES 0xA20000
#define TH_2ZONES_SIZE_BYTES 0x1440000
*/
+
+#define TH_PER_MIRROR
#define TH_FULL_PER_LRF
#ifndef TH_FULL_PER_LRF
#define TH_PER_LRF
#endif
-
-#ifdef ENCODER_7200
- #define TH_SIZE_NODES 0xA2000
- #define TH_LINE_NODES 0x900
- #define TH_SIZE_BYTES 0x288000
- #define TH_LINE_BYTES 0x2400
- #define TH_2ZONES_SIZE_BYTES 0x510000
- #define TH_16ZONES_SIZE_BYTES 0x2881000
- //#ifdef ROLLING_THRESHOLD
- // #define TH_24ZONES_SIZE_BYTES 0x3CC0000
- //#endif
-#else
- #define TH_SIZE_NODES ( M_SCAN_POINTS * Q_SCAN_COUNT ) //0xA2000
- #define TH_LINE_NODES M_SCAN_POINTS //0x900
- #define TH_SIZE_BYTES ( TH_SIZE_NODES << 2 ) //0x288000
- #define TH_LINE_BYTES ( TH_LINE_NODES << 2 ) //0x2400
- #define TH_2ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 1 ) //0x510000
- #define TH_16ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 4 ) //0x2881000
- //#ifdef ROLLING_THRESHOLD
- // #define TH_24ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 4 + TH_SIZE_BYTES << 3 )
- //#endif
-#endif
-
-#ifdef TH_PER_LRF
- #define TH_KERNEL_SIZE_NODES 0x14400
- #define TH_KERNEL_LINE_NODES 0x120
-#endif
-
-#define TARGET_BASE 0x9A880000 // TH_BASE + 0x2880000
-#define MAX_TARGETS_COUNT 32
-#define TARGET_ZONE_SIZE 0x4000 //( sizeof(targetRecord) * MAX_TARGETS_COUNT )
-
+#ifdef TH_PER_MIRROR
+ #ifdef ENCODER_7200
+ #define TH_SIZE_NODES 0x288000
+ #define TH_LINE_NODES 0x900
+ #define TH_SIZE_BYTES 0xA20000
+ #define TH_LINE_BYTES 0x2400
+ #define TH_2ZONES_SIZE_BYTES 0x510000
+ #define TH_16ZONES_SIZE_BYTES 0x2881000
+ //#ifdef ROLLING_THRESHOLD
+ // #define TH_24ZONES_SIZE_BYTES 0x3CC0000
+ //#endif
+ #else
+ #define TH_SIZE_NODES ( M_SCAN_POINTS * Q_SCAN_COUNT ) //0xA2000
+ #define TH_LINE_NODES M_SCAN_POINTS //0x900
+ #define TH_SIZE_BYTES ( TH_SIZE_NODES << 2 ) //0x288000
+ #define TH_LINE_BYTES ( TH_LINE_NODES << 2 ) //0x2400
+ #define TH_2ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 1 ) //0x510000
+ #define TH_16ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 4 ) //0x2881000
+ //#ifdef ROLLING_THRESHOLD
+ // #define TH_24ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 4 + TH_SIZE_BYTES << 3 )
+ //#endif
+ #endif
+
+ #ifdef TH_PER_LRF
+ #define TH_KERNEL_SIZE_NODES 0x14400
+ #define TH_KERNEL_LINE_NODES 0x120
+ #endif
+
+ #define TARGET_BASE 0x9A880000 // TH_BASE + 0x2880000
+ #define MAX_TARGETS_COUNT 32
+ #define TARGET_ZONE_SIZE 0x4000 //( sizeof(targetRecord) * MAX_TARGETS_COUNT )
+#else // !TH_PER_MIRROR
+ #ifdef ENCODER_7200
+ #define TH_SIZE_NODES 0xA2000
+ #define TH_LINE_NODES 0x900
+ #define TH_SIZE_BYTES 0x288000
+ #define TH_LINE_BYTES 0x2400
+ #define TH_2ZONES_SIZE_BYTES 0x510000
+ #define TH_16ZONES_SIZE_BYTES 0x2881000
+ //#ifdef ROLLING_THRESHOLD
+ // #define TH_24ZONES_SIZE_BYTES 0x3CC0000
+ //#endif
+ #else
+ #define TH_SIZE_NODES ( M_SCAN_POINTS * Q_SCAN_COUNT ) //0xA2000
+ #define TH_LINE_NODES M_SCAN_POINTS //0x900
+ #define TH_SIZE_BYTES ( TH_SIZE_NODES << 2 ) //0x288000
+ #define TH_LINE_BYTES ( TH_LINE_NODES << 2 ) //0x2400
+ #define TH_2ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 1 ) //0x510000
+ #define TH_16ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 4 ) //0x2881000
+ //#ifdef ROLLING_THRESHOLD
+ // #define TH_24ZONES_SIZE_BYTES ( TH_SIZE_BYTES << 4 + TH_SIZE_BYTES << 3 )
+ //#endif
+ #endif
+
+ #ifdef TH_PER_LRF
+ #define TH_KERNEL_SIZE_NODES 0x14400
+ #define TH_KERNEL_LINE_NODES 0x120
+ #endif
+
+ #define TARGET_BASE 0x9A880000 // TH_BASE + 0x2880000
+ #define MAX_TARGETS_COUNT 32
+ #define TARGET_ZONE_SIZE 0x4000 //( sizeof(targetRecord) * MAX_TARGETS_COUNT )
+#endif //! TH_PER_MIRROR
#define SCANS_TO_FLIP 16
#define SIGNAL_OFFSET 32
#define SIGNAL_ORDER 3
diff --git a/lib/pru/core00/main_core00.c b/lib/pru/core00/main_core00.c
index b0448e53..fc1109d1 100644
--- a/lib/pru/core00/main_core00.c
+++ b/lib/pru/core00/main_core00.c
@@ -648,6 +648,9 @@ void main(){
//near uint16_t m_uScanAngle = 0;
//near uint16_t m_uHVShiftCounter = 0;
//near uint8_t m_bPulsesEnable = 0;
+#ifdef TH_PER_MIRROR
+ near uint16_t m_nMirrorID = 0;
+#endif
near uint8_t m_bCatchVZ = 1;
near uint8_t m_bCatchHZ = 1;
near uint8_t m_bWaitFirstVZ = 1;
@@ -788,8 +791,12 @@ void main(){
m_bCatchVZ = 0;
m_bWaitFirstVZ = 0;
bVZero = 1;
+#ifdef TH_PER_MIRROR
+ m_nMirrorID = 0;
+#endif
m_uQ_Mirror_P_Count = m_uVM_SHIFT;
//m_uMirrorAngle = 0;
+
} else {
m_bCatchVZ = 1;
};
@@ -797,32 +804,56 @@ void main(){
// Pulse Logic For Conform Work
if( m_uCurrenrRunCntV != HW_CORE1.Q_RUN_COUNTER ){
m_uCurrenrRunCntV = HW_CORE1.Q_RUN_COUNTER;
+
+# ifdef TH_PER_MIRROR
+ // Increment Mirror counter
+ if( ( bVZero == 0 ) && ( ( m_uCurrenrRunCntV % Q_Q_INTERLEAVE ) == 0 ) ) {
+ m_nMirrorID += 0x1000;
+ };
+# endif
+
// PRF Divider Logic
if ( ( m_uCurrenrRunCntV % SYS_IOS.flags.inter_mode ) == 0 ){
// Shift Logic
m_uQ_Mirror_SP_Count = ( m_uQ_Mirror_P_Count + m_uVM_SHIFT ) % Q_Q_INTERLEAVE;
if( ( m_uQ_Mirror_SP_Count > Q_PULSE_START ) && ( m_uQ_Mirror_SP_Count < Q_PULSE_STOP ) ){
//if( m_uMirrorAngle < g_PULSES[SYS_IOS.flags.inter_mode] ){
- if( bVZero && bHZero ){
- DR_TUPUS3.HOST_data = 0x000000FF;
- bHZero = bVZero = 0;
- }; // HW_Z-Mark
+ if( bVZero ){ // Enought just vertical zero && bHZero ){
+ DR_TUPUS3.HOST_data = 0x000000FF;
+ bHZero = bVZero = 0;
+ }; // HW_Z-Mark
// Send Base Base Coord
DR_TUPUS2.HOST_data = HW_CORE1.STATUS_bit.B_motor_cnt;
// Send Q motor Coord
switch( SYS_IOS.flags.inter_mode ){
- case 1:
- DR_TUPUS2.PRU_data = ( m_uQ_Mirror_SP_Count - Q_PULSE_START) - 1;
+ case 1:
+# ifdef TH_PER_MIRROR
+ DR_TUPUS2.PRU_data = m_nMirrorID | (( m_uQ_Mirror_SP_Count - Q_PULSE_START) - 1 );
+# else
+ DR_TUPUS2.PRU_data = ( m_uQ_Mirror_SP_Count - Q_PULSE_START) - 1;
+# endif
break;
- case 2:
- DR_TUPUS2.PRU_data = (( m_uQ_Mirror_SP_Count - Q_PULSE_START) >> 1 )- 1;
+ case 2:
+# ifdef TH_PER_MIRROR
+ DR_TUPUS2.PRU_data = m_nMirrorID | ((( m_uQ_Mirror_SP_Count - Q_PULSE_START) >> 1 )- 1);
+# else
+ DR_TUPUS2.PRU_data = (( m_uQ_Mirror_SP_Count - Q_PULSE_START) >> 1 )- 1;
+# endif
break;
- case 3:
- DR_TUPUS2.PRU_data = (( m_uQ_Mirror_SP_Count - Q_PULSE_START - 1 ) >> 1 ) - 1 - ( ( m_uQ_Mirror_SP_Count - Q_PULSE_START ) >> 2 );
+ case 3:
+# ifdef TH_PER_MIRROR
+ DR_TUPUS2.PRU_data = m_nMirrorID | ((( m_uQ_Mirror_SP_Count - Q_PULSE_START - 1 ) >> 1 ) - 1 - ( ( m_uQ_Mirror_SP_Count - Q_PULSE_START ) >> 2 ));
+# else
+ DR_TUPUS2.PRU_data = (( m_uQ_Mirror_SP_Count - Q_PULSE_START - 1 ) >> 1 ) - 1 - ( ( m_uQ_Mirror_SP_Count - Q_PULSE_START ) >> 2 );
+# endif
break;
- default:
- DR_TUPUS2.PRU_data = (( m_uQ_Mirror_SP_Count - Q_PULSE_START - 1 ) >> 2 ) - 1;
+ default:
+# ifdef TH_PER_MIRROR
+ DR_TUPUS2.PRU_data = m_nMirrorID | ((( m_uQ_Mirror_SP_Count - Q_PULSE_START - 1 ) >> 2 ) - 1);
+# else
+ DR_TUPUS2.PRU_data = (( m_uQ_Mirror_SP_Count - Q_PULSE_START - 1 ) >> 2 ) - 1;
+# endif
break;
};
# ifndef PULSE_ALWAYS
diff --git a/lib/pru/core00/out.log b/lib/pru/core00/out.log
deleted file mode 100644
index 04917f8a..00000000
--- a/lib/pru/core00/out.log
+++ /dev/null
@@ -1,5 +0,0 @@
-FILE: main_core00.obj
-CODE size (bytes): 1300
-CONST size (bytes): 228
-DATA size (bytes): 7718
-
diff --git a/lib/pru/core10/main_core10.c b/lib/pru/core10/main_core10.c
index 873683d2..b09047ef 100644
--- a/lib/pru/core10/main_core10.c
+++ b/lib/pru/core10/main_core10.c
@@ -298,10 +298,18 @@ void main(void) {
// DR_TUPUS.HOST_status = 0;
// Mirrors
#ifdef PRU_SLAVE
- cMirrorAddress = Q_SCAN_COUNT - DR_TUPUS.PRU_data;
+ #ifdef TH_PER_MIRROR
+ cMirrorAddress = ( Q_SCAN_COUNT - ( DR_TUPUS.PRU_data & 0xFFF )) | ( DR_TUPUS.PRU_data & 0xF000 );
+ #else
+ cMirrorAddress = Q_SCAN_COUNT - ( DR_TUPUS.PRU_data & 0xFFF );
+ #endif
#else
+ #ifdef TH_PER_MIRROR
/* Additional calculation is for Constant calculation Time purposes Only!!! */
- cMirrorAddress = 0 + DR_TUPUS.PRU_data;
+ cMirrorAddress = ( 0 + ( DR_TUPUS.PRU_data & 0xFFF )) | ( DR_TUPUS.PRU_data & 0xF000 );
+ #else
+ cMirrorAddress = 0 + ( DR_TUPUS.PRU_data & 0xFFF );
+ #endif
#endif
DR_TUPUS.PRU_data = 0;
SYS_IOS.flags.b_shift = 0;
diff --git a/lib/pru/core11/main_core11.c b/lib/pru/core11/main_core11.c
index bff85b6e..e193349c 100644
--- a/lib/pru/core11/main_core11.c
+++ b/lib/pru/core11/main_core11.c
@@ -136,7 +136,59 @@ near thresholdNode m_sCurrentThresholdNode = {0};
#define WMODE_SOME_THRESHOLD 2
#define WMODE_DETECTION_ENABLED 3
-#ifdef TH_FULL_PER_LRF
+#ifdef TH_PER_MIRROR
+ #define WORKING_TH_MASK 0x20
+ volatile thresholdNode
+ *th_node[40] = {
+ // First Threshold
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 0 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 1 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 2 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 3 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 4 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 5 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 6 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 7 ) ),
+ // Second Threshold
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 8 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 9 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 10 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 11 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 12 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 13 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 14 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 15 ) ),
+ // Threed Threshold
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 16 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 17 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 18 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 19 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 20 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 21 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 22 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 23 ) ),
+ // Fourth Threshold
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 24 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 25 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 26 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 27 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 28 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 29 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 30 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 31 ) ),
+ // Working Threshold
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 32 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 33 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 34 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 35 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 36 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 37 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 38 ) ),
+ (volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 39 ) )
+ };
+#else
+ #define WORKING_TH_MASK 0x08
+ #ifdef TH_FULL_PER_LRF
volatile thresholdNode
*th_node[16] = {
// First Threshold
@@ -148,7 +200,7 @@ near thresholdNode m_sCurrentThresholdNode = {0};
(volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 5 ) ),
(volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 6 ) ),
(volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 7 ) ),
- // Second Threshold
+ // Working Threshold
(volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 8 ) ),
(volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 9 ) ),
(volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 10 ) ),
@@ -158,12 +210,13 @@ near thresholdNode m_sCurrentThresholdNode = {0};
(volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 14 ) ),
(volatile thresholdNode *)( TH_BASE + ( TH_SIZE_BYTES * 15 ) )
};
-#else
+ #else
volatile thresholdNode *th_node[2] = {
(volatile thresholdNode *)TH_BASE,
(volatile thresholdNode *)( TH_BASE + TH_SIZE_BYTES )
};
-#endif
+ #endif
+#endif// TH_PER_MIRROR
volatile targetRecord *target_node = (volatile targetRecord *)TARGET_BASE;
@@ -230,7 +283,47 @@ inline void resetMode( void ){
//DR_TUPUS.PRU_data = index;
th_node[0][index].data = m_sCurrentThresholdNode.data;
th_node[1][index].data = m_sCurrentThresholdNode.data;
-#ifdef TH_FULL_PER_LRF
+#ifdef TH_PER_MIRROR
+ th_node[2][index].data = m_sCurrentThresholdNode.data;
+ th_node[3][index].data = m_sCurrentThresholdNode.data;
+ th_node[4][index].data = m_sCurrentThresholdNode.data;
+ th_node[5][index].data = m_sCurrentThresholdNode.data;
+ th_node[6][index].data = m_sCurrentThresholdNode.data;
+ th_node[7][index].data = m_sCurrentThresholdNode.data;
+ th_node[8][index].data = m_sCurrentThresholdNode.data;
+ th_node[9][index].data = m_sCurrentThresholdNode.data;
+ th_node[10][index].data = m_sCurrentThresholdNode.data;
+ th_node[11][index].data = m_sCurrentThresholdNode.data;
+ th_node[12][index].data = m_sCurrentThresholdNode.data;
+ th_node[13][index].data = m_sCurrentThresholdNode.data;
+ th_node[14][index].data = m_sCurrentThresholdNode.data;
+ th_node[15][index].data = m_sCurrentThresholdNode.data;
+ th_node[16][index].data = m_sCurrentThresholdNode.data;
+ th_node[17][index].data = m_sCurrentThresholdNode.data;
+ th_node[18][index].data = m_sCurrentThresholdNode.data;
+ th_node[19][index].data = m_sCurrentThresholdNode.data;
+ th_node[20][index].data = m_sCurrentThresholdNode.data;
+ th_node[21][index].data = m_sCurrentThresholdNode.data;
+ th_node[22][index].data = m_sCurrentThresholdNode.data;
+ th_node[23][index].data = m_sCurrentThresholdNode.data;
+ th_node[24][index].data = m_sCurrentThresholdNode.data;
+ th_node[25][index].data = m_sCurrentThresholdNode.data;
+ th_node[26][index].data = m_sCurrentThresholdNode.data;
+ th_node[27][index].data = m_sCurrentThresholdNode.data;
+ th_node[28][index].data = m_sCurrentThresholdNode.data;
+ th_node[29][index].data = m_sCurrentThresholdNode.data;
+ th_node[30][index].data = m_sCurrentThresholdNode.data;
+ th_node[31][index].data = m_sCurrentThresholdNode.data;
+ th_node[32][index].data = m_sCurrentThresholdNode.data;
+ th_node[33][index].data = m_sCurrentThresholdNode.data;
+ th_node[34][index].data = m_sCurrentThresholdNode.data;
+ th_node[35][index].data = m_sCurrentThresholdNode.data;
+ th_node[36][index].data = m_sCurrentThresholdNode.data;
+ th_node[37][index].data = m_sCurrentThresholdNode.data;
+ th_node[38][index].data = m_sCurrentThresholdNode.data;
+ th_node[39][index].data = m_sCurrentThresholdNode.data;
+#else
+ #ifdef TH_FULL_PER_LRF
th_node[2][index].data = m_sCurrentThresholdNode.data;
th_node[3][index].data = m_sCurrentThresholdNode.data;
th_node[4][index].data = m_sCurrentThresholdNode.data;
@@ -245,6 +338,7 @@ inline void resetMode( void ){
th_node[13][index].data = m_sCurrentThresholdNode.data;
th_node[14][index].data = m_sCurrentThresholdNode.data;
th_node[15][index].data = m_sCurrentThresholdNode.data;
+ #endif
#endif
};
@@ -356,7 +450,9 @@ near uint8_t *mo_id[12] = {
void main(void) {
near uint32_t buildDate = 0;
- //near uint16_t m_nMirrorCounter = 0;
+#ifdef TH_PER_MIRROR
+ near uint16_t m_nMirrorID = 0;
+#endif
near uint8_t bMirrorStarted = 0;
#ifdef PRU_SLAVE
near uint32_t mShiftOld = Q_SCAN_COUNT;
@@ -510,7 +606,12 @@ soft_reset:
// Base
cShift = DR_TUPUS2.HOST_address;
// Mirrors
+#ifdef TH_PER_MIRROR
+ mShift = DR_TUPUS2.PRU_address & 0x0FFF;
+ m_nMirrorID = ( DR_TUPUS2.PRU_address & 0xF000 ) >> 8; // not 12 to create mask
+#else
mShift = DR_TUPUS2.PRU_address;
+#endif
#ifdef PRU_SLAVE
if( mShiftOld < mShift ) bMirrorStarted = 1;
#else
@@ -553,8 +654,12 @@ soft_reset:
// m_sCurrentThresholdNode.values.min = 4095;
// detector will clear values on first measure
m_sCurrentThresholdNode.values.cnt = 0;
- th_node[ index ][cSampleID] = m_sCurrentThresholdNode;
- th_node[8|index][cSampleID] = m_sCurrentThresholdNode;
+ #ifndef TH_PER_MIRROR
+ th_node[ index ][cSampleID] = m_sCurrentThresholdNode;
+ #else
+ th_node[ m_nMirrorID | index ][cSampleID] = m_sCurrentThresholdNode;
+#endif
+ th_node[ WORKING_TH_MASK | index ][cSampleID] = m_sCurrentThresholdNode;
} else {
# endif
//m_bNodeIsChanged = 0;
@@ -589,7 +694,7 @@ soft_reset:
};
};
// Get Working MinMax Values
- m_sCurrentThresholdNode = th_node[8|index][cSampleID];
+ m_sCurrentThresholdNode = th_node[ WORKING_TH_MASK | index ][cSampleID];
// If Working TH Node is Valid
if( m_sCurrentThresholdNode.values.cnt != 0 ){
// Check Current Measured Values
@@ -666,7 +771,11 @@ soft_reset:
// If no Spikes Detected
if( bDetected == 0 ){
/* Get Active MinMax Values */
- m_sCurrentThresholdNode = th_node[ index ][cSampleID];
+#ifdef TH_PER_MIRROR
+ m_sCurrentThresholdNode = th_node[ m_nMirrorID | index ][cSampleID];
+#else
+ m_sCurrentThresholdNode = th_node[ index ][cSampleID];
+#endif
if( m_sCurrentThresholdNode.values.cnt != 0 ){
// Study
if( m_nSignal > m_sCurrentThresholdNode.values.max ){
@@ -681,7 +790,11 @@ soft_reset:
m_sCurrentThresholdNode.values.min = m_nSignal;
};
m_sCurrentThresholdNode.values.cnt++; // cnt = 8 bit 0 - 256
+#ifdef TH_PER_MIRROR
+ th_node[ m_nMirrorID | index ][cSampleID] = m_sCurrentThresholdNode;
+#else
th_node[ index ][cSampleID] = m_sCurrentThresholdNode;
+#endif
};
// End of Building Threshold ------------------------------------------------------------------------------------
# ifdef CHECK_SUN_BIT
diff --git a/put_to_git b/put_to_git
index 41e97af9..f63a2e78 100755
--- a/put_to_git
+++ b/put_to_git
@@ -1,4 +1,4 @@
#!/bin/bash
#git commit -a -m '$1'
-git commit -a -m 'Fixed Some issues with BasicTransport object in 3DServer'
+git commit -a -m 'PRU changed tp work with each Mirror and LRF separately'