|
@@ -18,7 +18,7 @@ void _Slave_Ports_queue__INIT( Slave_Ports_Status_QUEUE_T* Slave_Ports_Status_QU
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-void _Slave_Ports_queue__add( Slave_Ports_Status_QUEUE_T* Slave_Ports_Status_QUEUE_A,
|
|
|
|
|
|
|
+ARDUINO_FUNCT_INIT_RESULT_T _Slave_Ports_queue__add( Slave_Ports_Status_QUEUE_T* Slave_Ports_Status_QUEUE_A,
|
|
|
TASK_TYPE_T TASK_TYPE_A,
|
|
TASK_TYPE_T TASK_TYPE_A,
|
|
|
TASK_PORT_ASSOC_T TASK_PORT_ASSOC_A,
|
|
TASK_PORT_ASSOC_T TASK_PORT_ASSOC_A,
|
|
|
long time_seq_id,
|
|
long time_seq_id,
|
|
@@ -26,7 +26,8 @@ long time_min_run //,
|
|
|
//int _Slave_Ports_queue_peek , int _Slave_Ports_queue_push , int _Slave_Ports_queue_peek_new
|
|
//int _Slave_Ports_queue_peek , int _Slave_Ports_queue_push , int _Slave_Ports_queue_peek_new
|
|
|
) {
|
|
) {
|
|
|
Serial.println(".");
|
|
Serial.println(".");
|
|
|
- Serial.print("#152 _Slave_Ports_queue__add peek: [");
|
|
|
|
|
|
|
+ Serial.print("#152 _Slave_Ports_queue__add TASK_TYPE_A[");
|
|
|
|
|
+ Serial.print(TASK_TYPE_A); Serial.print("] peek:[");
|
|
|
int _Slave_Ports_queue_peek = _Slave_Ports_queue.peek() ;
|
|
int _Slave_Ports_queue_peek = _Slave_Ports_queue.peek() ;
|
|
|
int _Slave_Ports_queue_back = _Slave_Ports_queue.back() ;
|
|
int _Slave_Ports_queue_back = _Slave_Ports_queue.back() ;
|
|
|
// int _Slave_Ports_queue_push_new_ref;
|
|
// int _Slave_Ports_queue_push_new_ref;
|
|
@@ -101,3 +102,164 @@ void _Slave_Ports_queue__list( Slave_Ports_Status_QUEUE_T* Slave_Ports_Status_QU
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ void _Slave_Ports_queue__POP( Slave_Ports_Status_QUEUE_T* Slave_Ports_Status_QUEUE_A,
|
|
|
|
|
+ int _Slave_Ports_queue_count,
|
|
|
|
|
+ int _Slave_Ports_queue_pop,
|
|
|
|
|
+ int _Slave_Ports_queue_front,
|
|
|
|
|
+ int _Slave_Ports_queue_back,
|
|
|
|
|
+ int _Slave_Ports_queue_peek,
|
|
|
|
|
+ int LCDtim, Slave_Ports_Status_T* Slave_Ports_Status_A
|
|
|
|
|
+ //DISPLAY
|
|
|
|
|
+ , DISPLAY_T* DISPLAY_A ,
|
|
|
|
|
+ DISPLAY_T_ARDUINO_ATTR_ARRAY_T &DISPLAY_T_ARDUINO_ATTR_ARRAY_A ,
|
|
|
|
|
+ DISPLAY_PHYSICAL_CHAR_T &DISPLAY_PHYSICAL_CHAR_A
|
|
|
|
|
+
|
|
|
|
|
+ ) {
|
|
|
|
|
+ //int count = _Slave_Ports_queuev.count();
|
|
|
|
|
+ //int _Slave_Ports_queue_pop _Slave_Ports_queuev.pop();
|
|
|
|
|
+ Serial.print("#180 run _Slave_Ports_queue__POP cnt "); Serial.print(_Slave_Ports_queue_count); Serial.print(" , pop: "); Serial.println(_Slave_Ports_queue_pop);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (_Slave_Ports_queue_count > 0) {
|
|
|
|
|
+ /*
|
|
|
|
|
+ String LCDarray1 = "`Slave_Ports_queue size [";
|
|
|
|
|
+ LCDarray1.concat(_Slave_Ports_queue_count);
|
|
|
|
|
+ LCDarray1.concat("] Oldest[");
|
|
|
|
|
+ LCDarray1.concat(_Slave_Ports_queue_pop);
|
|
|
|
|
+
|
|
|
|
|
+ LCDarray1.concat("] Curr[");
|
|
|
|
|
+ LCDarray1.concat(_Slave_Ports_queue_front);
|
|
|
|
|
+
|
|
|
|
|
+ String LCDarray2 = "] last[";
|
|
|
|
|
+ LCDarray2.concat(_Slave_Ports_queue_back);
|
|
|
|
|
+ LCDarray2.concat("] Next[");
|
|
|
|
|
+ LCDarray2.concat(_Slave_Ports_queue_peek);
|
|
|
|
|
+ Serial.print(LCDarray1);
|
|
|
|
|
+ Serial.println(LCDarray2);
|
|
|
|
|
+ */
|
|
|
|
|
+ #if defined(DEBUG)
|
|
|
|
|
+ Serial.print("#166 _queue__POP [DEBUG] INF size["); Serial.print(_Slave_Ports_queue_count);
|
|
|
|
|
+ Serial.print("] pop["); Serial.print(_Slave_Ports_queue_pop);
|
|
|
|
|
+ Serial.print("] front["); Serial.print(_Slave_Ports_queue_front);
|
|
|
|
|
+ Serial.print("] back["); Serial.print(_Slave_Ports_queue_back);
|
|
|
|
|
+ Serial.print("] peek["); Serial.print(_Slave_Ports_queue_peek);
|
|
|
|
|
+ Serial.println("] ");
|
|
|
|
|
+ #endif
|
|
|
|
|
+
|
|
|
|
|
+// LCD_print(LCDarray1, LCDarray2, LCDtim / 3 ) ;
|
|
|
|
|
+
|
|
|
|
|
+ if(Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].QUEUE_ID_A == 0 and
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].QUEUE_ID_A == 0 and
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A == 0 and
|
|
|
|
|
+ //Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_PORT_ASSOC_A == 0 and
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].time_seq_id == 0 and
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].time_min_run == 0 ) {
|
|
|
|
|
+ /* todo
|
|
|
|
|
+ String LCDarray1 = "#206 Error with queue";
|
|
|
|
|
+ String LCDarray2 = "ID: ";
|
|
|
|
|
+ LCDarray2.concat( _Slave_Ports_queue_pop); LCDarray2.concat("] ");
|
|
|
|
|
+ Serial.print(LCDarray1);
|
|
|
|
|
+ Serial.println(LCDarray2);
|
|
|
|
|
+ // LCD_print(LCDarray1, LCDarray2, LCDtim / 3 ) ;
|
|
|
|
|
+ */
|
|
|
|
|
+ #if defined(DEBUG)
|
|
|
|
|
+ // if(DEBUG > 6) {
|
|
|
|
|
+ Serial.print("#166 _queue__POP [DEBUG] Error with queue [_Slave_Ports_queue_pop"); Serial.print(_Slave_Ports_queue_pop);
|
|
|
|
|
+ Serial.println("] ");
|
|
|
|
|
+ // }
|
|
|
|
|
+ #endif
|
|
|
|
|
+ } else {
|
|
|
|
|
+ /*todo
|
|
|
|
|
+ String LCDarray1 = "#407 Running task";
|
|
|
|
|
+ String LCDarray2 = "ID: ";
|
|
|
|
|
+ LCDarray2.concat( _Slave_Ports_queue_pop); LCDarray2.concat("] task_type[");
|
|
|
|
|
+
|
|
|
|
|
+ LCDarray2.concat( Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A); LCDarray2.concat("] ");
|
|
|
|
|
+
|
|
|
|
|
+ Serial.print(LCDarray1);
|
|
|
|
|
+ Serial.println(LCDarray2);
|
|
|
|
|
+ // LCD_print(LCDarray1, LCDarray2, LCDtim / 3 ) ;
|
|
|
|
|
+ */
|
|
|
|
|
+ if(Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].time_min_run > millis()) {
|
|
|
|
|
+ Serial.print("#182 QUEUE reassign .time_seq_id > millis() time_seq_id["); Serial.print( Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].time_seq_id);
|
|
|
|
|
+ Serial.print("] millis()["); Serial.print(millis());
|
|
|
|
|
+ Serial.print("] TASK_TYPE_A["); Serial.print(Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A);
|
|
|
|
|
+ Serial.print("] POP/ID ["); Serial.print(_Slave_Ports_queue_pop); Serial.println("] ");
|
|
|
|
|
+ _Slave_Ports_queue__add( Slave_Ports_Status_QUEUE_A,
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A,
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_PORT_ASSOC_A,
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].time_seq_id,
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].time_min_run
|
|
|
|
|
+ );
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop]={} ;
|
|
|
|
|
+
|
|
|
|
|
+ } else if(Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A == TASK_TYPE_T_Slave_Ports_ttl_decrement) {
|
|
|
|
|
+
|
|
|
|
|
+ Serial.print("#224 running _Slave_Ports_ttl_decrement = "); Serial.println( Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A); Serial.println("]");
|
|
|
|
|
+ //#include "_Slave_Ports_ttl_decrement.h"
|
|
|
|
|
+ _Slave_Ports_ttl_decrement_POP(Slave_Ports_Status_QUEUE_A, _Slave_Ports_queue_pop , Slave_Ports_Status_A ) ;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } else if(Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A == TASK_TYPE_T_Slave_Ports_broadcast____) {
|
|
|
|
|
+ Serial.print("#337 running _Slave_Ports_broadcast = "); Serial.println( Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A); Serial.println("]");
|
|
|
|
|
+ // #include "_Slave_Ports_ttl_decrement.h"
|
|
|
|
|
+ _Slave_Ports_broadcast_POP(Slave_Ports_Status_QUEUE_A, _Slave_Ports_queue_pop , Slave_Ports_Status_A, LCDtim ) ;
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ Serial.print("$177 Error unsupported type TASK_TYPE_A["); Serial.print( Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A);
|
|
|
|
|
+ Serial.println("] REASSIGN NEXT QUEUE FOR FURTHER ACTION");
|
|
|
|
|
+ _Slave_Ports_queue__add( Slave_Ports_Status_QUEUE_A,
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_TYPE_A,
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop].TASK_PORT_ASSOC_A,
|
|
|
|
|
+ millis(),
|
|
|
|
|
+ millis() + ARDUINO_time_seq_id_A_INCREMENT
|
|
|
|
|
+ );
|
|
|
|
|
+ Slave_Ports_Status_QUEUE_A[_Slave_Ports_queue_pop]={} ;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ String LCDarray1 = "Nothing to";
|
|
|
|
|
+ String LCDarray2 = "process...";
|
|
|
|
|
+ //LCDarray2.reserve(16);
|
|
|
|
|
+ Serial.print(LCDarray1);
|
|
|
|
|
+ Serial.println(LCDarray2);
|
|
|
|
|
+
|
|
|
|
|
+ // Serial.print("#32 String LCDarray2 len");
|
|
|
|
|
+ // int LCDarray2_length = LCDarray2.length;
|
|
|
|
|
+ /* Serial.print(LCDarray2.length());
|
|
|
|
|
+ Serial.println("] now ");
|
|
|
|
|
+ LCDarray2 = make_str16(LCDarray2);
|
|
|
|
|
+ Serial.print(LCDarray2.length());
|
|
|
|
|
+ Serial.println("] next #338");
|
|
|
|
|
+
|
|
|
|
|
+ for(int i = 0; i < (17 - LCDarray2.length()); i++)
|
|
|
|
|
+ LCDarray2 += 'x';
|
|
|
|
|
+
|
|
|
|
|
+ Serial.print(LCDarray2.length());
|
|
|
|
|
+ Serial.println("] ");
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+ Serial.print(" #364 scount ");
|
|
|
|
|
+ Serial.print(_Slave_Ports_queue_count);
|
|
|
|
|
+ Serial.print(" _Slave_Ports_queue.front(): ");
|
|
|
|
|
+ Serial.print(_Slave_Ports_queue_front);
|
|
|
|
|
+ Serial.print(" _Slave_Ports_queue.back(): ");
|
|
|
|
|
+ Serial.print(_Slave_Ports_queue_back);
|
|
|
|
|
+ Serial.print(" _Slave_Ports_queue.peek(): ");
|
|
|
|
|
+ Serial.println(_Slave_Ports_queue_peek);
|
|
|
|
|
+// LCD_print(LCDarray1, LCDarray2, LCDtim / 3 ) ;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|