Contribute
Register

MacTester57's iMac G5 17" (A1058 Model)

Status
Not open for further replies.
This project is getting downright impressive. Excellent job to you both!


Cheers,
Ersterhernd
 
Hi ersterhernd

Thanks for the praise! :) As you know, I've ordered three SMC boards, but will most likely never use all of them. If you are interested, I could send you one.

At the moment im adding a preferences window to the slider applet. The readings window works fine and can be displayed via the secret menu (alt key).

Gruss an alle

MacTester
 
Hmmm, sounds like a great excuse to come to Canada and deliver the SMC in person ;).

I'm hanging up my modding tools at the moment, all three of the latest iMac G5 builds are purring like kittens and motorcycle season is just around the corner.

Kudos to you and kiwi for stepping forward with the custom blend of hardware and software. The plug 'n play G5 build may be in the cards from what I've seen so far. Next, perhaps a TMDS to HDMI SMC conversion board would be an idea? It would make the mod much easier for a novice to attempt.


Cheers!

Ersterhernd
 
Hmmm, sounds like a great excuse to come to Canada and deliver the SMC in person .

I would love to do that, but it's just not realistic @ the moment.

and motorcycle season is just around the corner.

Enjoy the motorcycle season!

Next, perhaps a TMDS to HDMI SMC conversion board would be an idea? It would make the mod much easier for a novice to attempt.

I had the same thought. But I think, that unsoldering the TMDS connector is still too difficult for a novice.

MacTester
 
Preferences window added

The Slider Applet was enhanced with a preferences window in the meantime:
Readings and Preferences.png


MacTester
 
Last edited:
Preferences window added

The Slider Applet was enhanced with a preferences window in the meantime:
Readings%20and%20Preferences.png


MacTester
Awesome work, I can see you are getting the hang of ObjectiveC. :thumbup:

FYI if you are looking for things to include in the app, then a test of the LED function could also be useful. Also my current firmware has two commands "SS" and "SU", here is the respective outputs.

"SS" - System Statistics

SMC Power Cycles 45
Power On Cycles 26
Sleep Cycles 519
Powered Hours 838.1
Active Hours 133.9
LCD Hours 104.6

"SU" - System Uptime

Threads used 4 of 10
RAM in use 809 of 2560 bytes
SMC Up Time 38 Days 02:54
CPU Up Time 11 Days 03:32

Note: The stats a re backed by eeprom, so survive software re-flashing.

Kiwi
 
Awesome work, I can see you are getting the hang of ObjectiveC

Thanks, kiwi. It comes together, but there is still a lot to learn...

I've used the "MP" (Melody Play) command for testing the Apple Chime. Works fine. Today I've added the following timer function, which refreshes the readings every 2s:

Code:
- (void) intervalTimer {
    //
    // 2s Interval Timer
    //
    if ([ReadingsWindow isVisible]) {
        [self get_rpm]; // get current RPM and temperature readings by loading from the Arduino
        NSLog( @"Readings refreshed");
    }

    // loop this function every 2s in order to refresh the readings!
    dispatch_async(dispatch_get_main_queue(), ^{
        [NSTimer scheduledTimerWithTimeInterval:2.0f target:self selector:@selector(intervalTimer) userInfo:nil repeats:NO];
    });
}

MacTester
 
Last edited:
Terminal added

I've added a terminal to the preferences window. Example: type MP (Melody Play) and press enter. The Chime start melody is then played:
Terminal.png


Code:
- (IBAction)TerminalTextFieldEnter:(NSTextField *)sender {
   
    //
    // Terminal
    //
   
    // make sure serial port open
    if (serialHandle<=0) serialHandle= serialport_init([serialPort UTF8String], serialBaud);{
      
        NSString *serialCommand = [terminalTextField stringValue];//read the text field
        const char *buffer = [serialCommand UTF8String];
        char buf[32];
        sprintf(buf, "%s\n", buffer);           //format the command
        serialport_write(serialHandle, buf);    //send the command
        NSLog(@"Terminal Message sent: %s",buf);
    }
}

The next step will be to add a NSTextField, which displays the arriving serial commands from the Arduino.

MacTester
 
Last edited:
The next step is done:
Terminal 2.png


The terminal is now fully functional and a good replacement for the Arduino terminal. After the command is sent with "Enter", the answer from the Arduino (if available) is displayed.

And a short Youtube video, which shows the functionality:

Code:
Code:
- (IBAction)TerminalTextFieldEnter:(NSTextField *)sender {
   
    //
    // Terminal
    //
   
    // make sure serial port open
    if (serialHandle<=0) serialHandle= serialport_init([serialPort UTF8String], serialBaud);{
      
        NSString *serialCommand = [terminalTextField stringValue];//read the text field
        const char *buffer = [serialCommand UTF8String];
        char buf[128];
        sprintf(buf, "%s\n", buffer);           //format the command
        serialport_write(serialHandle, buf);    //send the command
        NSLog(@"Terminal Message sent: %s",buf);
   
   
        // read result from serial port, until receive \n or timeout
        serialport_read_until(serialHandle, buf, '\n', 128, 500);
        NSString *val1 = [NSString stringWithCString:buf encoding:NSASCIIStringEncoding];
        [terminalAnswerTextField setStringValue:val1];  //display the answer from the Arduino
        NSLog(@"Terminal Message received: %s",buf);
    }
}

MacTester
 

Attachments

  • BrightnessMenulet_MacTester.zip
    255 KB · Views: 118
Last edited:
In the meantime, I've enhanced the terminal functionality. It can now even be used for flashing the EEPROM with new values. Thanks again to kiwi for his ingenious Arduino EEPROM code. :thumbup:

Overview:
O.png


System Statistics:
SS.png


Flashing EEPROM entry 17 with 250:
EW.png


EEPROM Read
ER.png



Code:
Code:
- (IBAction)TerminalTextFieldEnter:(NSTextField *)sender {
   
    //
    // Terminal
    //
   
    // make sure serial port open
    if (serialHandle<=0) serialHandle= serialport_init([serialPort UTF8String], serialBaud);{
      
        NSString *serialCommand = [terminalTextField stringValue];//read the text field
        const char *buffer = [serialCommand UTF8String];
        char buf[512];
        sprintf(buf, "%s\n", buffer);           //format the command
        serialport_write(serialHandle, buf);    //send the command
        NSLog(@"Terminal Message sent: %s",buf);
   
   
        // read result from serial port, until receive \ or timeout
        serialport_read_until(serialHandle, buf, '\f', 512, 100);
        NSString *val1 = [NSString stringWithCString:buf encoding:NSASCIIStringEncoding];
        [terminalAnswerTextView setString:val1];  //display the answer from the Arduino
        NSLog(@"Terminal Message received: %s",buf);
    }
}

MacTester
 
Last edited:
Status
Not open for further replies.
Back
Top