From 1b92f30f6dfa27392ffd8460ebeb17c17550db7b Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Wed, 18 Dec 2019 09:00:24 +0200 Subject: version 1.4.6.1 PMR: thread load and power down reporting. fix USB driver large files bug. ids pressure relief. some looking into the thread load sequence --- .../ContinueThreadLoadingResponse.pb-c.h | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h (limited to 'Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h') diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h new file mode 100644 index 000000000..ae83a671f --- /dev/null +++ b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h @@ -0,0 +1,74 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: ContinueThreadLoadingResponse.proto */ + +#ifndef PROTOBUF_C_ContinueThreadLoadingResponse_2eproto__INCLUDED +#define PROTOBUF_C_ContinueThreadLoadingResponse_2eproto__INCLUDED + +#include + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "ThreadLoadingState.pb-c.h" + +typedef struct _ContinueThreadLoadingResponse ContinueThreadLoadingResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _ContinueThreadLoadingResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_state; + ThreadLoadingState state; + char *errorreason; +}; +#define CONTINUE_THREAD_LOADING_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&continue_thread_loading_response__descriptor) \ + , 0, THREAD_LOADING_STATE__None, NULL } + + +/* ContinueThreadLoadingResponse methods */ +void continue_thread_loading_response__init + (ContinueThreadLoadingResponse *message); +size_t continue_thread_loading_response__get_packed_size + (const ContinueThreadLoadingResponse *message); +size_t continue_thread_loading_response__pack + (const ContinueThreadLoadingResponse *message, + uint8_t *out); +size_t continue_thread_loading_response__pack_to_buffer + (const ContinueThreadLoadingResponse *message, + ProtobufCBuffer *buffer); +ContinueThreadLoadingResponse * + continue_thread_loading_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void continue_thread_loading_response__free_unpacked + (ContinueThreadLoadingResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*ContinueThreadLoadingResponse_Closure) + (const ContinueThreadLoadingResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor continue_thread_loading_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_ContinueThreadLoadingResponse_2eproto__INCLUDED */ -- cgit v1.3.1 From 39c91b49017808b41d36d28406b5f78f06ab0e39 Mon Sep 17 00:00:00 2001 From: Shlomo Hecht Date: Thu, 19 Dec 2019 15:59:40 +0200 Subject: fix thread loading messaging, IDS - fix gradient job end bug, thread - huge --- .../ContinueThreadLoadingResponse.pb-c.c | 43 +++------------------ .../ContinueThreadLoadingResponse.pb-c.h | 6 +-- .../Embedded_SW/Embedded/Modules/IDS/IDS_maint.c | 3 +- .../Embedded_SW/Embedded/Modules/IDS/IDS_print.c | 44 ++++++++-------------- .../Embedded/Modules/Thread/ThreadLoad.c | 31 ++++++++------- .../Embedded/Modules/Thread/Thread_print.c | 6 +-- 6 files changed, 43 insertions(+), 90 deletions(-) (limited to 'Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h') diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.c b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.c index aa61cd30e..4e7244306 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.c +++ b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.c @@ -52,42 +52,9 @@ void continue_thread_loading_response__free_unpacked assert(message->base.descriptor == &continue_thread_loading_response__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } -static const ProtobufCFieldDescriptor continue_thread_loading_response__field_descriptors[2] = -{ - { - "State", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_ENUM, - offsetof(ContinueThreadLoadingResponse, has_state), - offsetof(ContinueThreadLoadingResponse, state), - &thread_loading_state__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "ErrorReason", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - offsetof(ContinueThreadLoadingResponse, errorreason), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned continue_thread_loading_response__field_indices_by_name[] = { - 1, /* field[1] = ErrorReason */ - 0, /* field[0] = State */ -}; -static const ProtobufCIntRange continue_thread_loading_response__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; +#define continue_thread_loading_response__field_descriptors NULL +#define continue_thread_loading_response__field_indices_by_name NULL +#define continue_thread_loading_response__number_ranges NULL const ProtobufCMessageDescriptor continue_thread_loading_response__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, @@ -96,10 +63,10 @@ const ProtobufCMessageDescriptor continue_thread_loading_response__descriptor = "ContinueThreadLoadingResponse", "", sizeof(ContinueThreadLoadingResponse), - 2, + 0, continue_thread_loading_response__field_descriptors, continue_thread_loading_response__field_indices_by_name, - 1, continue_thread_loading_response__number_ranges, + 0, continue_thread_loading_response__number_ranges, (ProtobufCMessageInit) continue_thread_loading_response__init, NULL,NULL,NULL /* reserved[123] */ }; diff --git a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h index ae83a671f..8d9a98326 100644 --- a/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h +++ b/Software/Embedded_SW/Embedded/Communication/PMR/ThreadLoading/ContinueThreadLoadingResponse.pb-c.h @@ -14,7 +14,6 @@ PROTOBUF_C__BEGIN_DECLS # error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. #endif -#include "ThreadLoadingState.pb-c.h" typedef struct _ContinueThreadLoadingResponse ContinueThreadLoadingResponse; @@ -27,13 +26,10 @@ typedef struct _ContinueThreadLoadingResponse ContinueThreadLoadingResponse; struct _ContinueThreadLoadingResponse { ProtobufCMessage base; - protobuf_c_boolean has_state; - ThreadLoadingState state; - char *errorreason; }; #define CONTINUE_THREAD_LOADING_RESPONSE__INIT \ { PROTOBUF_C_MESSAGE_INIT (&continue_thread_loading_response__descriptor) \ - , 0, THREAD_LOADING_STATE__None, NULL } + } /* ContinueThreadLoadingResponse methods */ diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c index c49fd81f0..41452cbad 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_maint.c @@ -476,7 +476,7 @@ uint32_t IDS_Dispenser_Alarm_On (uint8_t DispenserId) if (Extended_Motor_Param == true) Power_Step_01_Dispenser_Mode(DispenserId,Voltage); //status |= MotorSetMicroStep(MotorId, KeepMicrostep[DispenserId]); - status |= MotorStop(DispenserId, Hard_Hiz); + status |= MotorStop(MotorId, Hard_Hiz); IDS_Dispenser_Init(DispenserId); JobEndReason = JOB_OUT_OF_DYE; return status; @@ -509,7 +509,6 @@ uint32_t IDS_Check_Pressure_Callback(uint32_t DispenserId, uint32_t ReadValue) if (GetDispenserPressure(DispenserId)>3.0) { Report("Pulling dispenser down to reduce pressure",__FILE__,DispenserId,(int)(GetDispenserPressure(DispenserId)*100),RpWarning,200,0); - MotorMove(HW_Motor_Id,1-MotorsCfg[HW_Motor_Id].directionthreadwize,200*MotorsCfg[HW_Motor_Id].microstep); } return OK; diff --git a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c index 3af6416cb..9fdcaaf1f 100644 --- a/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c +++ b/Software/Embedded_SW/Embedded/Modules/IDS/IDS_print.c @@ -81,7 +81,7 @@ int lInterSegmentLength = 0; uint32_t InterSegmentStartWFCFDispensers; uint32_t WFCF = 80; bool EnableCleaning = true; - +bool JobEndSequence = false; void IDS_Dispenser_SetPreSegmentWFCFValues(double dispenserpresegmentwfcf, double ids_presegment_wfcf_timebeforesegment) { if (ids_presegment_wfcf_timebeforesegment) @@ -228,7 +228,7 @@ JobDescriptionFileBrushStop *FirstBrushStop = NULL; int brushCounter = 0; - GeneralHwReady = false; + //GeneralHwReady = false; for (Dispenser_i = 0;Dispenser_i0.1)&&(feedertension<1.5)) { Report("Setting pressure from RML feeder tension",__FILE__,__LINE__,(int)(feedertension*100),RpWarning,(int)(DispenserPreparePressure*100),0); @@ -733,7 +734,7 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) } else { - /**/if (AutoHoming_Config >= AutoHoming_JobEnd_PowerOn_off) + if (AutoHoming_Config >= AutoHoming_JobEnd_PowerOn_off) { if ((HomingActive[i] == false)&&(PrimingActive[i] == false)) { @@ -744,26 +745,7 @@ uint32_t InactiveDispenserHome(uint32_t DispenserId, uint32_t ReadValue) { Report("Inactive dispenser already homing",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); } - }/**/ - /*if ((HomingActive[i] == false)&&(PrimingActive[i] == false)) - { - Report("Inactive dispenser open valve",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); - Control3WayValvesWithCallback (i, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer - Report("Homing Inactive dispenser",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); - IDS_HomeDispenser (i, 1000 , NULL); - } - else - { - Report("Inactive dispenser already homing",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); - } - }*/ - //if ((HomingActive[i] == false)&&(PrimingActive[i] == false)) - //{ - // Report("Inactive dispenser open valve",__FILE__,i,HomingActive[i],RpWarning,PrimingActive[i],0); - // Control3WayValvesWithCallback (i, Dispenser_Mixer, NULL); //direction: MidTank_Dispenser or Dispenser_Mixer - //} - //ControlIdtoInactiveDispenserId[Dispenser_i] = AddControlCallback( IDS_Check_Pressure_Callback, eOneMinute,TemplateDataReadCBFunction ,0, 0, 0 ); - + } } } if (NumOfActiveDispensers) @@ -1401,6 +1383,12 @@ uint32_t IDSBrushStopRestartCallback(uint32_t IfIndex, uint32_t readValue) int n_dispensers = 0; JobSegment* Segment = (void *)IfIndex; + if (JobEndSequence == true) + { + Report("JobEndSequence",__FILE__,__LINE__,(int)JobBrushStopId,RpWarning,(int)SegmentNumOfBrushStops,0); + SafeRemoveControlCallback(BrushStopControlId,IDSBrushStopRestartCallback); + BrushStopControlId = 0Xff; + } if (uploadstrategy == JOB_UPLOAD_STRATEGY__Default) { Dispensers = Segment->brushstops[JobBrushStopId]->dispensers; @@ -1464,10 +1452,10 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) #endif IDS_Cleaning_Stop_Cleaning_Solution(NULL); SegmentNumOfBrushStops = Segment->n_brushstops; - BrushStopTime = Segment->length/SegmentNumOfBrushStops; //brushstop in meters + BrushStopTime = Segment->length*1000/(double)SegmentNumOfBrushStops; //brushstop in meters //brushstop in millisecond BrushStopTime = ((BrushStopTime*100)/dyeingspeed);//brushstop in seconds - BrushStopTime *= 1000; //brushstop in millisecond - Report("IDSSegmentState",__FILE__,__LINE__,(int)BrushStopTime,RpWarning,(int)SegmentNumOfBrushStops,0); + //BrushStopTime *= 1000; + Report("IDSSegmentState",__FILE__,__LINE__,(int)(BrushStopTime*1000),RpWarning,(int)SegmentNumOfBrushStops,0); if (uploadstrategy == JOB_UPLOAD_STRATEGY__Default) { Dispensers = Segment->brushstops[JobBrushStopId]->dispensers; @@ -1557,7 +1545,7 @@ uint32_t IDSSegmentState(void *SegmentDetails, int SegmentId) if (FileBrushStop) FreeBrushStopFileData(FileBrushStop); FileBrushStop = NULL; - + JobEndSequence = true; lInterSegmentLength = (dryerbufferCentimeters*1000/dyeingspeed); lInterSegmentLength-=(lInterSegmentLength%100); //round to a 100 multiplication InterSegmentStepsCount = 0; diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c index 373e4bbd9..13b98bcb0 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/ThreadLoad.c @@ -445,7 +445,7 @@ MotorSetMaxSpeed (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, 500); // MotorMovetoLimitSwitch (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1,MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, 500, Motor_Id_to_LS_IdDown[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1], Thread_Load_HomingCallback,25000); - MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, (2000*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].microstep), Thread_Load_HomingCallback,20000); + MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_LDANCER1, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].directionthreadwize, (5000*MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_LDANCER1].microstep), Thread_Load_HomingCallback,20000); return OK; } @@ -607,7 +607,7 @@ CallbackCounter++; Report("Thread_Load_Dryer_Loading",__FILE__,__LINE__,LoadStages,RpMessage,CallbackCounter,0); MotorMoveWithCallback (HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM, MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_DRYER_LOADARM].directionthreadwize, - numberOfSteps, Thread_Load_Dryer_Loading_Callback, 100000); + numberOfSteps-400, Thread_Load_Dryer_Loading_Callback, 100000); //Keep Notation How Many Rotations In The Dryer //LoadArmInfo.LoadArmBackLash = 0; @@ -1079,7 +1079,6 @@ uint32_t ThreadLoadingReport(void) MessageContainer responseContainer; bool last = false; StartThreadLoadingResponse response = START_THREAD_LOADING_RESPONSE__INIT; - ContinueThreadLoadingResponse Cresponse = CONTINUE_THREAD_LOADING_RESPONSE__INIT; if (ThreadLoadingToken[0] == 0) return OK; @@ -1093,7 +1092,6 @@ uint32_t ThreadLoadingReport(void) if (LoadStages == THREAD_LOAD_INITIAL_TENSION) { response.state = THREAD_LOADING_STATE__ReadyForLoading; - last = true; } } else @@ -1101,32 +1099,30 @@ uint32_t ThreadLoadingReport(void) response.state = THREAD_LOADING_STATE__PreparationError; response.errorreason = LoadErrorMsg; } - responseContainer = createContainer(MESSAGE_TYPE__StartThreadLoadingResponse, ThreadLoadingToken, last, &response, &start_thread_loading_response__pack, &start_thread_loading_response__get_packed_size); - responseContainer.continuous = true; } else if (MessageState == 2) { - Cresponse.has_state = true; + response.has_state = true; if (LoadStatus == OK) { - Cresponse.state = THREAD_LOADING_STATE__Finalizing; + response.state = THREAD_LOADING_STATE__Finalizing; if (LoadStages >= THREAD_LOAD_JOG_THREAD) { - Cresponse.state = THREAD_LOADING_STATE__Completed; + response.state = THREAD_LOADING_STATE__Completed; last = true; } } else { - Cresponse.state = THREAD_LOADING_STATE__FinalizationError; - Cresponse.errorreason = LoadErrorMsg; + response.state = THREAD_LOADING_STATE__FinalizationError; + response.errorreason = LoadErrorMsg; } - responseContainer = createContainer(MESSAGE_TYPE__ContinueThreadLoadingResponse, ThreadLoadingToken, last, &Cresponse, &continue_thread_loading_response__pack, &continue_thread_loading_response__get_packed_size); - responseContainer.continuous = true; } else return ERROR; //------------------------------------------------------------------------------------------- + responseContainer = createContainer(MESSAGE_TYPE__StartThreadLoadingResponse, ThreadLoadingToken, last, &response, &start_thread_loading_response__pack, &start_thread_loading_response__get_packed_size); + responseContainer.continuous = true; uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); size_t container_size = message_container__pack(&responseContainer, container_buffer); my_free(responseContainer.data.data); @@ -1149,9 +1145,16 @@ uint32_t StartThreadLoadingFunc(MessageContainer* requestContainer) uint32_t ContinueThreadLoadingFunc(MessageContainer* requestContainer) { ContinueThreadLoadingRequest *request = continue_thread_loading_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); - ustrncpy (ThreadLoadingToken, requestContainer->token,36); + ContinueThreadLoadingResponse Cresponse = CONTINUE_THREAD_LOADING_RESPONSE__INIT; + MessageContainer responseContainer; MessageState = 2; ThreadLoadingReport(); + responseContainer = createContainer(MESSAGE_TYPE__ContinueThreadLoadingResponse, requestContainer->token, true, &Cresponse, &continue_thread_loading_response__pack, &continue_thread_loading_response__get_packed_size); + responseContainer.continuous = false; + uint8_t* container_buffer = my_malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + my_free(responseContainer.data.data); + SendChars((char*)container_buffer, container_size); return OK; } diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c index f0331b4bc..dd31e9cda 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_print.c @@ -722,6 +722,9 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request) JobCounter = 0; TotalProcessedLength = 0.0; PoolerTotalProcessedLength = 0.0; + InitialProcess = true; + initialpos = 0xFFFF; + Poolerinitialpos = 0xFFFF; PrepareState = true; AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_BREAK,false); AlarmHandlingSetAlarm(EVENT_TYPE__THREAD_TENSION_CONTROL_FAILURE_PULLER_DANCER,false); @@ -853,9 +856,6 @@ uint32_t ThreadInitialTestStub(HardwareMotor * request) #endif PrepareReady(Module_Thread,ModuleDone); //set 3 dancers to the profile positions - InitialProcess = true; - initialpos = 0xFFFF; - Poolerinitialpos = 0xFFFF; return OK; } -- cgit v1.3.1