PiDP-8/I Software

Check-in [b0f1224117]
Log In

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixed ILS tweaking
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | pi5-ils2-bworm-cyclerealistic
Files: files | file ages | folders
SHA1: b0f1224117818905094b5e7453d63f1125a67634
User & Date: HBEggenstein 2024-06-20 00:24:05
Context
2024-06-20
00:39
merged accidental fork Leaf check-in: adc65f80bb user: HBEggenstein tags: pi5-ils2-bworm-cyclerealistic
00:24
fixed ILS tweaking check-in: b0f1224117 user: HBEggenstein tags: pi5-ils2-bworm-cyclerealistic
2024-06-15
21:58
merge Steve Tockey's branch cycle-realistic into the pi5-ils2-bookworm branch check-in: d413ed639f user: HBEggenstein tags: pi5-ils2-bworm-cyclerealistic
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pidp8i/gpio-ils.c.

61
62
63
64
65
66
67

68

69
70
71
72
73
74
75
// The GPIO module's main loop core, called from thread entry point in
// gpio-common.c.


static int is_init = 0;

static float RISING_FACTOR = RISING_FACTOR_DEFAULT;

static float FALLING_FACTOR = FALLING_FACTOR_DEFAULT;


void gpio_core (int* terminate)
{
    // The ILS version uses an iteration rate that is somewhat faster than the NLS
    // version, depending on execution speed of the Raspberry Pi.
    // The overall refresh rate sould be between 80 and ~ 200 Hz.
    const us_time_t intervl = 20;







>

>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// The GPIO module's main loop core, called from thread entry point in
// gpio-common.c.


static int is_init = 0;

static float RISING_FACTOR = RISING_FACTOR_DEFAULT;
static float RISING_FACTOR_INIT = RISING_FACTOR_DEFAULT;
static float FALLING_FACTOR = FALLING_FACTOR_DEFAULT;
static float FALLING_FACTOR_INIT = FALLING_FACTOR_DEFAULT;

void gpio_core (int* terminate)
{
    // The ILS version uses an iteration rate that is somewhat faster than the NLS
    // version, depending on execution speed of the Raspberry Pi.
    // The overall refresh rate sould be between 80 and ~ 200 Hz.
    const us_time_t intervl = 20;
109
110
111
112
113
114
115



116
117
118
119
120
121
122
    	  int n = sscanf(tweaking, "%f,%f",&RISING_FACTOR,&FALLING_FACTOR);
          if ( n != 2 ||
               RISING_FACTOR > 1.0 || RISING_FACTOR <= 0.0 ||
               FALLING_FACTOR > 1.0 || FALLING_FACTOR <= 0.0 ) {
            RISING_FACTOR = RISING_FACTOR_DEFAULT;
            FALLING_FACTOR = FALLING_FACTOR_DEFAULT;
          }



        }
        if ( tweaking_ramp ) {
          us_time_t iv[MAX_BRIGHTNESS+1];
          int n = sscanf(tweaking_ramp, "%d,%d,%d,%d,%d,%d,%d,%d,"
                                   "%d,%d,%d,%d,%d,%d,%d,%d,"
                                   "%d,%d,%d,%d,%d,%d,%d,%d,"
                                   "%d,%d,%d,%d,%d,%d,%d,%d,%d",







>
>
>







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
    	  int n = sscanf(tweaking, "%f,%f",&RISING_FACTOR,&FALLING_FACTOR);
          if ( n != 2 ||
               RISING_FACTOR > 1.0 || RISING_FACTOR <= 0.0 ||
               FALLING_FACTOR > 1.0 || FALLING_FACTOR <= 0.0 ) {
            RISING_FACTOR = RISING_FACTOR_DEFAULT;
            FALLING_FACTOR = FALLING_FACTOR_DEFAULT;
          }
          // new values will later be fine tuned by auto-calibration
          RISING_FACTOR_INIT = RISING_FACTOR;
          FALLING_FACTOR_INIT = FALLING_FACTOR;
        }
        if ( tweaking_ramp ) {
          us_time_t iv[MAX_BRIGHTNESS+1];
          int n = sscanf(tweaking_ramp, "%d,%d,%d,%d,%d,%d,%d,%d,"
                                   "%d,%d,%d,%d,%d,%d,%d,%d,"
                                   "%d,%d,%d,%d,%d,%d,%d,%d,"
                                   "%d,%d,%d,%d,%d,%d,%d,%d,%d",
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
                printf("\n\rTime per iteration %f ms\n\r", cycle_ms);
#endif
		// is this value plausible?
		if(cycle_ms > 2.0 && cycle_ms < 30.0) {
		   // adjust the RISING_FACTOR and FALLING_FACCTOR
		   // the defaults are calibrated for a ca 7ms refresh time
                   filtered_cycle_ms=(filtered_cycle_ms==0) ? cycle_ms : filtered_cycle_ms * 0.7 + cycle_ms * 0.3;
                   RISING_FACTOR  = 1.0L - pow((1.0L - RISING_FACTOR_DEFAULT) , filtered_cycle_ms / 7.0);
                   FALLING_FACTOR = 1.0L - pow((1.0L - FALLING_FACTOR_DEFAULT), filtered_cycle_ms / 7.0);
		}


            }
            last_timing_stamp=time_now;
            timing_cnt=0;
        };







|
|







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
                printf("\n\rTime per iteration %f ms\n\r", cycle_ms);
#endif
		// is this value plausible?
		if(cycle_ms > 2.0 && cycle_ms < 30.0) {
		   // adjust the RISING_FACTOR and FALLING_FACCTOR
		   // the defaults are calibrated for a ca 7ms refresh time
                   filtered_cycle_ms=(filtered_cycle_ms==0) ? cycle_ms : filtered_cycle_ms * 0.7 + cycle_ms * 0.3;
                   RISING_FACTOR  = 1.0L - pow((1.0L - RISING_FACTOR_INIT) , filtered_cycle_ms / 7.0);
                   FALLING_FACTOR = 1.0L - pow((1.0L - FALLING_FACTOR_INIT), filtered_cycle_ms / 7.0);
		}


            }
            last_timing_stamp=time_now;
            timing_cnt=0;
        };