PiDP-8/I Software

Check-in [74efaad4a1]
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 | pi5-ils2-bookworm
Files: files | file ages | folders
SHA1: 74efaad4a1a4fe009b33bfdf12413742ee828d50
User & Date: HBEggenstein 2024-06-20 00:55:47
Context
2024-06-20
00:55
fixed ILS tweaking Leaf check-in: 74efaad4a1 user: HBEggenstein tags: pi5-ils2-bookworm
2024-06-15
16:55
Revert unconditional install of pidp8i.rc. We install it once, but don't mess with it if it's already there. check-in: 8b74d4f9fe user: poetnerd tags: pi5-ils2-bookworm
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

60
61
62
63
64
65
66

67

68
69
70
71
72
73
74
// 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;







>

>







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// 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;
108
109
110
111
112
113
114



115
116
117
118
119
120
121
    	  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",







>
>
>







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
    	  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",
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
                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;
        };







|
|







320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
                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;
        };