The Monitor in Photon

Cogent Tools Demo and Tutorials: Version 4.0
Prev | Chapter 11. PID Emulator and Monitor Functions | Next

# 11.3. The Monitor in Photon

All the functions for the Monitor in Photon are explained in in Tutorial One, Chapter 8, Photon Functions (in `phsimple.g`), in these sections:

Section 8.2, The Monitor Window - `create_monitor`
Section 8.3, Button Functions - `toggle_sym`, `change_settings` (but not `change_settings`[1])
Section 8.4, Callback Functions - `slider_callback`, `num_callback` (but not `num_callback`[2])
Section 8.5, Trend Functions - `accumulate_trends`, `update_trends`

The complete file for the Monitor in Photon can be found in Section 3.7, `phmonitor.g` - The Monitor program in Photon.

## 11.3.1. Differences between Tutorial One and Tutorial Two

The following Cogent Tools Demo functions were modified in Tutorial One because for that tutorial we didn't want to have to call any abstracted functions. Here you will notice that they do make calls to abstracted functions.

### 11.3.1.1. `update_trends`

The only difference between this function and the `update_trends` function documented in Tutorial One is the use of the abstracted function `.put_data` to assign the array of values to the `PtTrend` or `RtTrend` widget.

       /*--------------------------------------------------------------------
        * Function:    update_trends
        * Returns:     t or nil
        * Description: Assigns the most recent arrays to the trend widget.
        *------------------------------------------------------------------*/
       function update_trends (widget, syms...)
       {
         local        tarray = make_array (length(syms)), i = 0, sym;

         with sym in syms do
           tarray[i++] = getprop (sym, #tdata);
         widget.put_data(tarray);
         with sym in syms do
           shorten_array (getprop (sym, #tdata), 0);
       }

### 11.3.1.2. `create_monitor`

The only difference between this function and the `create_monitor` function documented in Tutorial One is the use of the abstracted function `anyos_assign` to select the correct widget file.

       /*--------------------------------------------------------------------
        * Function:    create_monitor
        * Returns:     doesnt' return
        * Description: Creates the Monitor window.
        *------------------------------------------------------------------*/
       function create_monitor ()
       {
         local wfile, window, monitor_win, slidesp, progmv, progpv;
         local slideauto, slidedp, numkp, numki, numkd, numprop, numint;
         local butam, butgood, butpoor, butosc, butout, butx;

         wfile = PhabReadWidgetFile(anyos_assign("monitor_widgetfile"));
         . . .

### Notes

[1] | The Tutorial One function `change_settings` is abstracted in Tutorial Two, and named `anyos_change_settings` in Tutorial Two.
[2] | The Tutorial One function `num_callback` is abstracted in Tutorial Two, and named `anyver_numeric_callback` in Tutorial Two.

Prev | Home | Next
The Monitor in GTK | Up | Controller Functions

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.