Ejemplo n.º 1
0
void StatusBlinkRed(uint8_t count) {
  uint8_t i;
  LEDsOff();
  for (i = 0; i < count; i++) {
    SetLED(0, 128, 0, 0);
    UpdateLEDs();
    _delay_ms(10);
    SetLED(0, 0, 0, 0);
    UpdateLEDs();
    _delay_ms(30);
  }
}
Ejemplo n.º 2
0
void LEDsOff() {
  uint8_t i;
  for (i = 0; i < LED_COUNT; ++i) {
    SetLED(i, 0, 0, 0);
  }
  UpdateLEDs();
}
Ejemplo n.º 3
0
void IEC::Reset(void)
{
	for (int i=0; i<4; i++)
		if (drive[i] != NULL && drive[i]->Ready)
			drive[i]->Reset();

	UpdateLEDs();
}
Ejemplo n.º 4
0
void signal_SIGCHLD (int a)
{
    extern int breezesimPid, gtkwavePid;
    int status;

    //    fprintf(stderr,"SIGCHLD %d\n",a);

    if (signal_SIGCHLD_ignoreNext)
    {
        signal_SIGCHLD_ignoreNext--;
        // printf ("ignored\n");
        return;
    }
    //    int pid = wait (&status);
    int pid = waitpid (0, &status, WNOHANG);

    if (!pid)
        return;

    //    printf("child died %d (%d %d)\n", pid, breezesimPid, gtkwavePid);

    if (WIFEXITED (status) || WIFSIGNALED (status))
    {
        if (breezesimPid == pid)
        {
            GrayControlIcons (TRUE, FALSE, TRUE);
            simulationIsRunning = FALSE;
            UpdateLEDs ();
            breezesimPid = 0;
        } else if (gtkwavePid == pid)
        {
            gtkwaveIsRunning = FALSE;
            UpdateLEDs ();
            gtkwavePid = 0;
        }

        if (WIFSIGNALED (status) && (pid == breezesimPid || pid == gtkwavePid))
        {
            GtkWidget *msg = create_InfoProcessCrashed ();

            gtk_widget_show (msg);
        }
    }
}
Ejemplo n.º 5
0
void AMWBattery::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

	if (bWantsPowerUp)
	{
		CurrentPower = FMath::Min(MaxPower, CurrentPower + PowerUpRate * DeltaTime);
	}
	else
	{
		float powerDownRate = PowerUpRate * 2;
		CurrentPower = FMath::Max(NormalPower, CurrentPower - powerDownRate * DeltaTime);
	}

	UpdateLEDs();
}
Ejemplo n.º 6
0
uint8 IEC::open_out(uint8 byte, bool eoi)
{
	if (name_len < NAMEBUF_LENGTH) {
		*name_ptr++ = byte;
		name_len++;
	}

	if (eoi) {
		*name_ptr = 0;				// End string
		listener->LED = DRVLED_ON;	// Turn on drive LED
		UpdateLEDs();
		return listener->Open(sec_addr, name_buf);
	}

	return ST_OK;
}
Ejemplo n.º 7
0
uint8 IEC::sec_listen(void)
{
	switch (received_cmd) {

		case CMD_OPEN:	// Prepare for receiving the file name
			name_ptr = name_buf;
			name_len = 0;
			return ST_OK;

		case CMD_CLOSE: // Close channel
			if (listener->LED != DRVLED_ERROR) {
				listener->LED = DRVLED_OFF;		// Turn off drive LED
				UpdateLEDs();
			}
			return listener->Close(sec_addr);
	}
	return ST_OK;
}
Ejemplo n.º 8
0
void IEC::NewPrefs(Prefs *prefs)
{
	// Delete and recreate all changed drives
	for (int i=0; i<4; i++)
		if ((ThePrefs.DriveType[i] != prefs->DriveType[i]) || strcmp(ThePrefs.DrivePath[i], prefs->DrivePath[i]) || ThePrefs.Emul1541Proc != prefs->Emul1541Proc) {
			delete drive[i];
			drive[i] = NULL;	// Important because UpdateLEDs is called from drive constructors (via set_error())
			if (!prefs->Emul1541Proc) {
				if (prefs->DriveType[i] == DRVTYPE_DIR)
					drive[i] = new FSDrive(this, prefs->DrivePath[i]);
				else if (prefs->DriveType[i] == DRVTYPE_D64)
					drive[i] = new D64Drive(this, prefs->DrivePath[i]);
				else
					drive[i] = new T64Drive(this, prefs->DrivePath[i]);
			}
		}

	UpdateLEDs();
}
void CMackieControlXT::OnRefreshSurface(DWORD fdwRefresh, bool bForceSend)
{
//	TRACE("CMackieControlXT::OnRefreshSurface()\n");

	CCriticalSectionAuto csa(m_cState.GetCS());

	ReconfigureXT(bForceSend);

	// Do the reconfigure before this so that the setup is up to date
	UpdateToolbarDisplay(bForceSend);

	// Now update the various sections
	UpdateLCDDisplay(bForceSend);
	UpdateLevelMeters(bForceSend);
	UpdateVPotDisplays(bForceSend);
	UpdateLEDs(bForceSend);

	if (!m_cState.GetDisableFaders())
		UpdateFaders(bForceSend);

	// Send this last so that it doesn't corrupt the display
	m_HwLCDDisplay.SetGlobalMeterMode(false, bForceSend);
}
Ejemplo n.º 10
0
void AMWBattery::PostInitializeComponents()
{
	Super::PostInitializeComponents();

	for (uint32 i = 0; i < kMaxLEDs; ++i)
	{
		// Attach to its point on the battery mesh
		FString name("led");
		name.AppendInt(i + 1);
		FName boneName(*name);
		LEDs[i]->AttachTo(BatteryMesh, boneName, EAttachLocation::SnapToTarget);

		// Assign common LED static mesh and create dynamic material. 
		LEDs[i]->StaticMesh = LEDMesh;
		LED_MIDs[i] = LEDs[i]->CreateAndSetMaterialInstanceDynamic(0);
	}

	BatteryMID = BatteryMesh->CreateAndSetMaterialInstanceDynamic(0);

	CurrentCharge = Capacity;
	CurrentPower = NormalPower;

	UpdateLEDs();
}
void Roomba::SetSLEDAmber(){
  LEDByte1 = (LEDByte1 | B00110000);
  UpdateLEDs();
}
void Roomba::SetSLEDRed(){
  LEDByte1 = (LEDByte1 & B11001111);
  LEDByte1 = (LEDByte1 | B00010000);
  UpdateLEDs();
}
void Roomba::SetSLEDOff(){
  LEDByte1 = (LEDByte1 & B11001111);
  UpdateLEDs();
}
void Roomba::SetPLEDColor(byte color){
  LEDByte2 = color;
  UpdateLEDs();
}
void Roomba::SetPLEDIntensity(byte intensity){
  LEDByte3 = intensity;
  UpdateLEDs();
}
Ejemplo n.º 16
0
void Launch_GTKWave (int delay)
{
    if (simulationIsRunning)
        Simulation_Pause ();

    if (gtkwaveIsRunning && gtkwavePid)
    {
        GtkWidget *GTKWaveRunningDialogue = create_GTKWaveRunningDialogue ();

        gtk_widget_show (GTKWaveRunningDialogue);
        return;
    }

    char *hhhfilename = g_strdup_printf ("%s.hhh", projectName);

    if (access (hhhfilename, R_OK) != 0)
    {
        GtkWidget *NoTraceFileDialogue = create_NoTraceFileDialogue ();

        gtk_widget_show (NoTraceFileDialogue);
        return;
    }

    if (pipe (gtkwave_pipe1) < 0) {
      perror("pipe");
      exit(1);
    }
    if (pipe (gtkwave_pipe2) < 0) {
      perror("pipe");
      exit(1);
    }

    gtkwavePid = fork ();
    if (gtkwavePid == 0)
    {
        signal (SIGCHLD, NULL);

        dup2 (gtkwave_pipe1[0], 3);
        dup2 (gtkwave_pipe2[1], 4);
        close (gtkwave_pipe1[1]);
        close (gtkwave_pipe2[0]);

        if (delay)
            sleep (delay);

        //        execlp ("gtkwave", "gtkwave", "-a", "-d", "1", hhhfilename, NULL);
        execlp ("gtkwave", "gtkwave", "-c", "-d", "1", hhhfilename, NULL);

        // If we reach here, then it means that gtkwave is not installed
        fprintf (stderr, "Error: GTKWave is not installed\n");
        sleep (1);
        _exit (0);
    }

    close (gtkwave_pipe1[0]);
    close (gtkwave_pipe2[1]);

    gtkwave_send_command ("hello\n");
    gtkwave_send_initchannel_commands ();

    gtkwaveIsRunning = TRUE;
    UpdateLEDs ();

    if (simulationIsRunning)
        Simulation_Play ();
}