diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-13 14:45:50 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-13 14:45:50 +0200 |
| commit | 281bfcfea70a1c7250e7c081de998e4ce0cc6e0e (patch) | |
| tree | 3dc6d142f2c9719248bd67edb854900b79e65558 /Software/Embedded_SW/Embedded/Modules | |
| parent | d0faa49dc04de0ceb5e9854e965bb32473bc5b85 (diff) | |
| parent | 0c43f6919cf12f126f501d84fb76c940b8e9c7bb (diff) | |
| download | Tango-281bfcfea70a1c7250e7c081de998e4ce0cc6e0e.tar.gz Tango-281bfcfea70a1c7250e7c081de998e4ce0cc6e0e.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Embedded_SW/Embedded/Modules')
3 files changed, 24 insertions, 18 deletions
diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c index c34702e5c..01e683dae 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.c @@ -577,30 +577,35 @@ void SendDiagnostics(void) if (diagnosticsresponseContainer.data.data) { - diagnosticscontainer_buffer = 0; - diagnosticscontainer_buffer = my_malloc(message_container__get_packed_size(&diagnosticsresponseContainer)); - if (diagnosticscontainer_buffer) + if (diagnosticscontainer_buffer == 0) //send new diagnostics packet only if the previous one was sent and released { - size_t container_size = message_container__pack(&diagnosticsresponseContainer, diagnosticscontainer_buffer); - if (SendChars(diagnosticscontainer_buffer, container_size) == false) //comm tx mailbox full + diagnosticscontainer_buffer = my_malloc(message_container__get_packed_size(&diagnosticsresponseContainer)); + if (diagnosticscontainer_buffer) { - DiagnosticsStop(); - CommunicationMailboxFlush(); + size_t container_size = message_container__pack(&diagnosticsresponseContainer, diagnosticscontainer_buffer); + if (SendChars(diagnosticscontainer_buffer, container_size) == false) //comm tx mailbox full + { + DiagnosticsStop(); + } + else + { + Report("Diagnostic Messgage",__FILE__,__LINE__,container_size,RpWarning,msec_millisecondCounter, msec_millisecondCounter); + } + diag_size[diag_index] = container_size; + diag_time[diag_index] = msec_millisecondCounter; + if (diag_index++>=MAX_DIAG_LOG) + diag_index = 0; } else { - //Report("Diagnostic Messgage",__FILE__,__LINE__,container_size,RpWarning,msec_millisecondCounter, msec_millisecondCounter); + LOG_ERROR(Task_self(),"my_malloc failed"); + DiagnosticsStop(); + CommunicationMailboxFlush(); } - diag_size[diag_index] = container_size; - diag_time[diag_index] = msec_millisecondCounter; - if (diag_index++>=MAX_DIAG_LOG) - diag_index = 0; - } else { - LOG_ERROR(Task_self(),"my_malloc failed"); - DiagnosticsStop(); + LOG_ERROR(Task_self(),"previous packet not sent"); } my_free(diagnosticsresponseContainer.data.data); } diff --git a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.h b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.h index 3fc0969f8..91d531972 100644 --- a/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.h +++ b/Software/Embedded_SW/Embedded/Modules/Diagnostics/Diagnostics.h @@ -11,6 +11,7 @@ extern bool blowervolatgedisplay; extern double voltage; +extern uint8_t* diagnosticscontainer_buffer; uint32_t StartDiagnosticsRequestFunc(MessageContainer* requestContainer); diff --git a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.new b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.new index f33a134e1..537d27775 100644 --- a/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.new +++ b/Software/Embedded_SW/Embedded/Modules/Thread/Thread_Winder.new @@ -177,14 +177,14 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction) float screw_horizontal_speed = 0; float RotationsPerSecond; - if (Counter%InternalWinderCfg.spoolbackingrate == 0) + if (Counter%InternalWinderCfg.spoolbackingrate == 1) { NumberOfSteps -= (Counter/InternalWinderCfg.spoolbackingrate); REPORT_MSG(ScrewNumberOfSteps, "Head Backing ScrewNumberOfSteps"); ScrewNumberOfSteps--; screw_horizontal_speed = ScrewNumberOfSteps / InternalWinderCfg.NumberOfRotationPerPassage; // calculation input#2: number of rotations per second - (basically: speed/winder perimeter. later - according to winder actual speed - calculate according to winder position accumulation in the last second. - RotationsPerSecond = CurrentControlledSpeed[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; + RotationsPerSecond = OriginalMotorSpd_2PPS[WINDER_MOTOR] / MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_WINDER].pulseperround; // calculation input#3: speed = rotation per second * traverse per rotation = traverse per second. speed set: traverse per second (mm) * pulses per mm. ScrewSpeed = screw_horizontal_speed*RotationsPerSecond; @@ -194,7 +194,7 @@ uint32_t CalculateNumberOfSteps (uint32_t Counter, bool direction) CurrentControlledSpeed[SCREW_MOTOR] = ScrewSpeed; } - if ((Counter%InternalWinderCfg.SpoolBottomBackingRate == 0)||(Counter%InternalWinderCfg.SpoolBottomBackingRate == 0)) + if ((Counter%InternalWinderCfg.SpoolBottomBackingRate == 0)||(Counter%InternalWinderCfg.SpoolBottomBackingRate == 1)) { if (direction != MotorsCfg[HARDWARE_MOTOR_TYPE__MOTO_SCREW].directionthreadwize) { |
