Author Topic: Delphi crash  (Read 2151 times)

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Delphi crash
« on: October 22, 2017, 04:23:33 AM »
Using V22.0.0.8 on Win 10.
With the cursor at the end of the line marked <<<<<<<<<<<<<<<<<<<<<<<, press ENTER then ENTER again, slick locks up (remove the <<< first perhaps).
Also if you have two instances of slick running (I often do), auto save doesn't work properly when you restart the instance that crashed.  I had to dig up the auto saved file myself.  I don't have time to provide full details about this, sorry.

Code: [Select]
procedure TManualCalibrationForm.MaintainAutoCalibrationState4;
var
  value_24vm : real;

begin
  //===================================================================================================
  // state 4 - reading analogs to check +24VM and 5VM voltages and IMON current
  //===================================================================================================

    inc(sample_count);
    if sample_count = 1 then
      begin
      // first time in, read analogs as fast as possible
      ClearInstructionsMemo;

      Timer1.Interval := 20;   
      no_response_counter := 0;
      stable_values := false;
      GotAnalogues := false;
      RequestAnalogueValues;
      exit;
      end;

    if not GotAnalogues then
      begin
      inc(no_response_counter);
      if no_response_counter > 10 then
        begin
        AddToMemo('No analog data received from jig');
        Timer1.Interval := 1000;    // wait 1 sec then check again
        RequestAnalogueValues; 
        no_response_counter := 0;
        end;
      exit;
      end;

    GotAnalogues := false;
    Timer1.Interval := 20;    // read analogs as fast as possible
    no_response_counter := 0;
    RequestAnalogueValues; 
    Grid1.Cells[col_reading_ad, row_24vm] := IntToStr(rx_analogs[id_analog_24vm]);
     
    if sample_count = 2 then
      begin
      start_analog_stability_monitor(id_analog_24vm);
      start_analog_stability_monitor(id_analog_5vm);
      start_analog_stability_monitor(id_analog_imon);
      exit;
      end;
         
    if continue_button_was_clicked then
      begin
      continue_button_was_clicked := false;
      TestState := test_state_wait_for_vmon_cal_to_be_ready;
      RequestTurnOffSupply;
      ClearInstructionsMemo;
      exit;
      end;
               
    // We look for 8 consecutive stable readings where the average is within a range of 2 (e.g. 2 to 4)
    if check_analog_value_for_stability(id_analog_24vm, 8, stability_value)
        and check_analog_value_for_stability(id_analog_5vm, 8, stability_value)
        and check_analog_value_for_stability(id_analog_imon, 8, stability_value) then 
      begin
      sample_count := 1;
      if not stable_values then
        begin
        stable_values := true;
        AddToMemo('Voltages are stable');
        end;




      // if enter_24vm_was_pressed then
      //   begin
      //   // when ENTER is pressed, calculate a new full scale value
      //   // full scale is (observed_reading * 1023) / A_D_reading
      //   enter_24vm_was_pressed := false;
      //   calibrated_a2d_24vm := rx_analogs[id_analog_24vm];
      //   full_scale_24vm := (value_measured_24vm * 1023) / (calibrated_a2d_24vm - zero_analog_24vm);
      //   Grid1.Cells[col_full_scale, row_24vm] := FloatToStr(full_scale_24vm);
      //   plus_24vm_has_been_calibrated := true;
      //   end;
      //
      // // calculate the voltage using the displayed full scale values
      // value_24vm := ((rx_analogs[id_analog_24vm] - zero_analog_24vm) * full_scale_24vm) / 1023;
      // Grid1.Cells[col_calculated_vi, row_24vm] := FloatToStr(value_24vm);
      exit;          <<<<<<<<<<<<<<<<<<<<<<<<<<<<
      end;  // analog values were stable

    // haven't read enough values or they're not stable
    if not plus_24vm_has_been_calibrated and (sample_count > 50) then
      begin
        AddToMemo('Analog values are varying too much.');
        AddToMemo('Try increasing the stability range setting by one count');
        sample_count := 1;
        stable_values := false;
      end;
end;

imtribble

  • Community Member
  • Posts: 43
  • Hero Points: 4
Re: Delphi crash
« Reply #1 on: October 22, 2017, 01:53:39 PM »
I would like to add that I can get it to crash by simply pasting code (a couple of lines) into a function and then hitting ENTER. Happens every time.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6862
  • Hero Points: 528
Re: Delphi crash
« Reply #2 on: October 22, 2017, 02:52:55 PM »
Looks like a Slick-C infinite loop. Press Ctrl+Alt+Shift+F2 to break it.

This should be hot fixable.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6862
  • Hero Points: 528
Re: Delphi crash
« Reply #3 on: October 22, 2017, 03:11:46 PM »
Try loading the attached macro fix for v22.0.0.x (Macro>Load Module).

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Delphi crash
« Reply #4 on: October 24, 2017, 11:20:08 AM »
Thanks for the super-fast fix.