Configuración Retropie - Raspberry Pi

Teclas en Retropie:


Para resetear las teclas:

Ir al menu de Retropie / Retropie Setup
Manage Packages / Manage Core Packages / Emulation Station (Installed) / Configuration Options / Clear Reset Emulation Station Input Configuration
Reiniciar


Archivo de configuración:

Las teclas pueden configurarse manualmente en este archivo:
/opt/retropie/configs/all/retroarch.cfg

** RECORDAR QUE LAS TECLAS DEBEN ESTAR EN MINUSCULAS! Ej a y no A


Teclas

Direccion: Flechas

Start: (1P Start en mame) - 1

Select: (2P Start en mame) - 2

B1 seleccionar - a          //tiene que ser a minúscula!!!! el rango que admite es a-z

B2 back - b

B3 - x

Coin - 5 (esta tecla se configura en MAME, no se usa en el frontend)

Exit: 1 + 2 (esto no se configura, para salir de un juego mame, apretar Start+Select


Cambiar orientación:


En windows, editar el archivo config.txt que está en la raiz de la SD card.

o en raspberry:

cd /boot
sudo nano config.txt

agregar la siguiente linea: display_rotate=3

para dejarlo por default: display_rotate=0

grabar con Ctrl-X


MAME - Desasignar tecla

Dar enter en la tecla a desasignar
Luego, presionar Escape

Roms

/home/pi/retropie/roms/mame-libretro/mame2003/cfg

Improve voice:

effects/limiter: db-8
effects/amplify: db: 6
peak: -2.0
desmarcar allow cliping
echo: 0.1 / 0.1
reverb


Improve voice:

Resetear:

sudo reboot

Copiar roms desde windows con SSH


en raspberry, habilitar SSH:

sudo raspi-config

advanced options
SSH
Yes
Finish

ver ip address:

ifconfig

ver donde dice inet Addr (ej, 192.168.0.111)

para saber ip addr desde windows:
https://angryip.org/download/#windows
En la lista de ip's escaneada, debe figurar como RETROPIE


En windows:

instalar WinSCP
crear una conexion nueva
escribir ip (ej, 192.168.0.111)
usuario: pi
password: raspberry





A4988 con Arduino



Codigo:

/*     Simple Stepper Motor Control Exaple Code
 *    
 *  by Dejan Nedelkovski, www.HowToMechatronics.com
 *
 */
// defines pins numbers
const int stepPin = 12;   //3;
const int dirPin = 11;    //4;

void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);
}
void loop() {
  digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
  // Makes 200 pulses for making one full cycle rotation
  for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(1000);
  }
  delay(1000); // One second delay
 
  digitalWrite(dirPin,LOW); //Changes the rotations direction
  // Makes 400 pulses for making two full cycle rotation
  for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(1000);
  }
  delay(1000);
}


Fuente: https://chenfuguo.gitbooks.io/arduino/content/Shields/a4988Controller.html
             http://howtomechatronics.com/

Configuracion CNC v3


ATENCION!!! PARA QUE FUNCIONE EL GRBL CONTROLLER DEBE ESTAR CONFIGURADO A 115200!!!


Voltage de los A4988

A = 1.25 * V
V = A / 1.25

Valores de voltage actuales:

X = .464
Y = .640
Z = .000

Configuración GRBL (VERSION 0.9)

$0=10
$1=25
$2=0
$3=0
$4=0
$5=0
$6=0
$10=3
$11=0.010
$12=0.002
$13=0
$20=0
$21=1
$22=0
$23=0
$24=25
$25=500
$26=250
$27=1
$100=6.320
$101=6.320
$102=51
$110=1000
$111=500
$112=500
$120=10
$121=10
$122=10
$130=200
$131=200
$132=200


Inkscape con gcodetools

Version de inkscape: 0.48
Con "gcodetools dev..."


Instalar gcodetools en Inkscape

instalar python2.7.9    https://www.python.org/ftp/python/2.7.9/python-2.7.9.msi
elegir la instalacion custom y marcar "add python.exe to path"

renombrar C:\Program Files\Inkscape\python a
C:\Program Files\Inkscape\python-old   *esto es para que no use este python sino el que instalamos en c:\*

abrir cmd como admin.

C:\Python27>pip install numpy

instalar:
lxml-3.3.5.win32-py2.7.exe

*si dice que no hay python 2.7 en la registry hacer esto:

copiar la clave de este path

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath

a este otro

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath

Abrir inkscape!!!


fuentes:
https://github.com/TurnkeyTyranny/laser-gcode-exporter-inkscape-plugin/blob/master/README.md
https://avaminzhang.wordpress.com/2011/11/24/python-version-2-7-required-which-was-not-found-in-the-registry/

Enviar model y parametros adicionales en llamado ajax

Javascript

            var datos = $('form').serializeArray();
            var usuarioSup = {
                name: "usuarioSupervisor",
                value: "abc"
            };
            var passwordSup = {
                name: "passwordSupervisor",
                value: "xxx"
            };
            datos.push(usuarioSup);
            datos.push(passwordSup);

            jqxhr2 = $.ajax({
                type: "POST",
                data: datos,
                dataType: "json",
                url: "@Url.Action(@Model.Accion, @Model.Controlador)",
                beforeSend: function () {
                }
            }).fail(function (jqXHR, textStatus) {
                $.unblockUI();
                $("#mensaje").html("Error: " + "Status: " + jqXHR.status + " detalle: " + textStatus + " detalle: " + jqXHR.responseText);
            }).success(function (data) {
                $.unblockUI();
                $("#mensaje").html(data.Mensaje);

                if (data.Codigo != "err_sup") {
                    $("#div_supervision").hide();
                    $("#@ViewBag.boton").removeProp("disabled");
                }
            });


MVC

[HttpPost]
public ActionResult Ejecutar(ConsultaViewModel modelo, string usuarioSupervisor, string passwordSupervisor)
        {
            return null;
        }

Configuracion GRBL 0.9

https://github.com/grbl/grbl/wiki/Configuring-Grbl-v0.9#grbls-xval-settings-and-what-they-mean

Compilar y subir GRBL 0.9 a arduino

Bajar el zip de este lugar:

https://github.com/grbl/grbl

luego descomprimirlo, y armar un .zip que solo tenga la carpeta que contiene los examples, los .h y los .c (este zip es el que luego hay que importar como libreria en Sketch / include library)

Primero hay que borrar la EPROM (ver este post para saber como hacerlo: http://expressraider.blogspot.com.uy/2015/02/arduino-midi-drums-paso-paso.html)

Instrucciones para subir el grbl:

https://github.com/grbl/grbl/wiki/Compiling-Grbl

Luego el grbl controller configurarlo a 115200

Utilizar Ajax en C# [Funciona!]

Importar esta librería:

       using System.Web.Script.Serialization;

Crear la clase DTO:

        public class PersonaDTO
        {
            public string Nombre { get; set; }
            public string Apellido { get; set; }
        }

Crear el ActionResult:

        [HttpGet]
        public ActionResult Buscar(int param)
        {
            var x = new Persona();

            x.Nombre = "Juana";
            x.Apellido = "Perez";

            return Json(x, JsonRequestBehavior.AllowGet);
        }

Agregar el código javascript en la vista:

<script>
    $(function () {       
        $.ajax({
            data: { 'param': 123 },
            url: "@Url.Action("Buscar", "Prueba")",
            type: 'GET',
            cache: false,
            success: function (response) {
                alert(response.Nombre);
            },
            error: function (a, b) {
                alert("error fatal");
                alert(a.responseText);
            }
        });
    });
</script>

Logger log4net en C# (para una aplicacion web)

1. Bajar log4net con NuGet

2. Dentro de Properties / AssemblyInfo.cs agregar la siguiente línea:

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Web.config", Watch = true)]

3. En web.config, agregar lo siguiente:

<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  </configSections>

  <log4net>
      <root>
        <level value="ALL" />
        <appender-ref ref="RollingLogFileAppender" />
      </root>
      <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
        <file value="output.log" />
        <appendToFile value="true" />
        <rollingStyle value="Size" />
        <maxSizeRollBackups value="5" />
        <maximumFileSize value="10MB" />
        <staticLogFileName value="true" />
        <filter type="log4net.Filter.LoggerMatchFilter">
          <loggerToMatch value="Amazon" />
          <acceptOnMatch value="false" />
        </filter>
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
        </layout>
      </appender>
    </log4net>
</configuration>


4. Para utilizarlo (por ejemplo en un controller)

private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(ClientesController));

public ActionResult Index()
{
    log.Info("prueba de log!");
    return View();
}

Instalar NOOBS en Raspberry PI 3


Si la tarjeta es mayor o igual a 64gb, debe ser formateada en FAT32.
Usar esto: http://www.ridgecrop.demon.co.uk/index.htm?guiformat.htm

Luego bajar el NOOBS y copiarlo a la tarjeta